void OnTriggerStay2D(Collider2D other) { MoveableGridObject otherGridObject = other.GetComponent <MoveableGridObject>(); BombObject bombObject = other.GetComponent <BombObject>(); if (bombObject) { bombObject.Roll(direction); } if (other.gameObject.CompareTag("Player")) { PlayerGridObject player = other.GetComponent <PlayerGridObject>(); if (player.platforms == 0) { player.Move(direction); } } else if (otherGridObject && !other.gameObject.CompareTag("WindSlime")) { otherGridObject.Move(direction); EnemyGridObject enemyGridObject = other.gameObject.GetComponent <EnemyGridObject>(); if (enemyGridObject) { enemyGridObject.TakeDamage(damage); } } }
protected void OnTriggerEnter2D(Collider2D other) { EnemyGridObject enemy = other.gameObject.GetComponent <EnemyGridObject>(); if (enemy) { spinning.Add(other.gameObject); } BombObject bomb = other.gameObject.GetComponent <BombObject>(); if (bomb) { bomb.LightFuse(); bomb.GetComponent <Animator>().SetTrigger("Roll"); spinning.Add(other.gameObject); } }
// searching how far from goal (heuristic) and how far from start (path cost) //bool flag = false; // Use this for initialization void Start() { // Priority Queue that sorts lowest cost to highest cost // From start position get all successor nodes // Calculate total cost for each node // add these nodes into PQ // While PQ not empty // Pop node // Check if goal // get all successors // calculate // push into PQ if (entity == null) { entity = GetComponent <EnemyGridObject>(); } InvokeRepeating("RandomMovement", 0, 1.0f / updateRate); }