Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class TrapBox : Bolt.EntityBehaviour<ITrapBox> {
- // Use this for initialization
- void Start () {
- }
- public override void Attached()
- {
- state.SetTransforms(state.Transform, transform);
- state.AddCallback("isAlive", StateChange);
- state.isAlive = true;
- }
- private void StateChange()
- {
- Debug.Log("IsAlive Change");
- GetComponent<MeshRenderer>().enabled = state.isAlive;
- }
- private void OnTriggerEnter(Collider other)
- {
- if (entity.isOwner)
- {
- Debug.Log("Trigger");
- if (other.CompareTag("Player"))
- {
- other.GetComponent<PlayerBoltLinker>().state.HP -= 10;
- state.isAlive = false;
- }
- }
- }
- private void FixedUpdate()
- {
- if (entity.isOwner)
- {
- transform.Rotate(20 * BoltNetwork.FrameDeltaTime, 20 * BoltNetwork.FrameDeltaTime,
- 20 * BoltNetwork.FrameDeltaTime);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement