public override bool ActionStart() { Debug.Log("PUSH ANIMATION", Department.PHYSICS, Color.ORANGE); arrive_comp = GetComponent <Arrive_Steering>(); GetComponent <Align_Steering>().SetEnabled(false); Movement_Action.Direction dir = GetComponent <Movement_Action>().GetDirection(); move = GetComponent <Movement_Action>(); anim_comp = GetComponent <CompAnimation>(); GetComponent <PerceptionSightEnemy>().GetPlayerTilePos(out int player_x, out int player_y); int tile_x = move.GetCurrentTileX(); int tile_y = move.GetCurrentTileY(); int dif_x = player_x - tile_x; int dif_y = player_y - tile_y; animation_clip_push = "Push"; anim_comp.PlayAnimationNode("Push"); target_x = move.GetCurrentTileX(); target_y = move.GetCurrentTileY(); target_x += (int)push_direction.x; target_y += (int)push_direction.z; return(true); }
void Start() { map = GetLinkedObject("map"); player = GetLinkedObject("player"); align = GetComponent <Align_Steering>(); arrive = GetComponent <Arrive_Steering>(); seek = GetComponent <Seek_Steering>(); anim_comp = GetComponent <CompAnimation>(); transform_comp = GetComponent <Transform>(); audio_comp = GetComponent <CompAudio>(); player_t = GetLinkedObject("player_obj"); BT bt = GetComponent <EnemySword_BT>(); if (bt == null) { bt = GetComponent <EnemyShield_BT>(); } if (bt == null) { bt = GetComponent <EnemySpear_BT>(); } if (bt == null) { bt = GetComponent <Boss_BT>(); } float interpolation = bt.GetCurrentInterpolation(); current_max_vel = hurt_max_vel + (max_vel - hurt_max_vel) * interpolation; current_max_accel = hurt_accel + (max_accel - hurt_accel) * interpolation; current_max_rot_vel = hurt_max_rot_vel + (max_rot_vel - hurt_max_rot_vel) * interpolation; current_max_rot_accel = hurt_max_rot_accel + (max_rot_accel - hurt_max_rot_accel) * interpolation; Vector3 fw = transform_comp.GetForwardVector(); path = new List <PathNode>(); //Set Occupied tile in Pathfinder tile = new PathNode(0, 0); tile.SetCoords((int)(transform_comp.position.x / tile_size + Mathf.Epsilon), (int)(transform_comp.position.z / tile_size + Mathf.Epsilon)); map.GetComponent <Pathfinder>().UpdateOccupiedTiles(gameObject.GetName(), tile); //Set direction SetDirection(); //Sideways animation speeds anim_comp.SetClipDuration("WalkRight", sideways_anim_speed); anim_comp.SetClipDuration("WalkLeft", sideways_anim_speed); anim_comp.SetClipDuration("WalkBack", sideways_anim_speed); anim_comp.SetClipDuration("WalkFront", sideways_anim_speed); blocking = false; path.Clear(); }