void OnCollisionEnter2D(Collision2D col) { // Can't called when win or die if (win || dead || translating) { return; } // // Reach destination // if (col.gameObject.tag == "EndPoint") // { // StartCoroutine(Win()); // } // Die but check whether damage when stop if (col.gameObject.tag == "Damagable") { StoppableObject stoppableObject = col.gameObject.GetComponent <StoppableObject>(); // Die if not stoppable object or always damagable if (stoppableObject == null || !cameraGrey.GetOn() || (cameraGrey.GetOn() && stoppableObject.freezeDamagable)) { Die(); } } }
public PatrolState(FiniteStateMachine parent, Dictionary <string, float> data) : base(parent) { this.moveSpeed = data["moveSpeed"]; this.mass = data["mass"]; this.curSpeed = data["curSpeed"]; this.reachRadius = data["reachRadius"]; this.areaWidth = data["areaWidth"]; // this.avoidDistance = data["avoidDistance"]; // this.avoidForce = data["avoidForce"]; patrolObjectBase = parent.GetParent(); patrolObjectTransform = patrolObjectBase.transform; // Get patrol path path = AStar.FindPath(parent.GetParent().transform.position, areaWidth); // Debug.Log(path); }
public FallSpikeSpawnPointFSM(StoppableObject parent) : base(parent) { }
public MovableBoardVerticalMoveState(FiniteStateMachine parent, float moveSpeed, Transform from, Transform to) : base(parent, moveSpeed, from, to) { stoppableObject = parent.GetParent(); }
public MovableBoardVerticalFSM(StoppableObject parent) : base(parent) { }
public LazerFSM (StoppableObject parent) : base(parent) {}
public CCTVFSM(StoppableObject parent) : base(parent) { }
public DisableState(FiniteStateMachine parent, float waitTime) : base(parent) { this.waitTime = waitTime; stoppableObject = parent.GetParent(); }
public void RemoveObject(StoppableObject stoppableObject) { myMultiDelegate -= stoppableObject.SwitchOnOrOff; }
public void AddObject(StoppableObject stoppableObject) { myMultiDelegate += stoppableObject.SwitchOnOrOff; }
// public bool collideWithPlayer { get; set; } public FiniteStateMachine(StoppableObject parent) { this.parent = parent; player = GameObject.FindGameObjectWithTag("Player").transform; }
public BulletSpawnPointFSM(StoppableObject parent) : base(parent) { }