override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (!Parent) { Parent = animator.GetComponent <RedAirStingray> ( ); horiMove = new PingPongMove(moveSpeed, moveRange, Parent.InitPos); } }
public AirStingrayMovement(Enemy parent, float moveSpeed, float moveRange, float sinkSpeed, LayerMask targetLayer, Collider2D collider, AnimationClip sinkAnim) : base(parent) { this.moveRange = moveRange; this.moveSpeed = moveSpeed; this.targetLayer = targetLayer; this.sinkSpeed = sinkSpeed; this.col = collider; this.sinkAnim = sinkAnim; initPos = this.Parent.tf.position; horiLoopMove = new PingPongMove(moveSpeed, moveRange, initPos, true, false); asg = (AirStingray)Parent; }
public RedAirStingrayMovement(Enemy parent, float pingPongVelocity, float rangeVelocity, Vector2 moveRange, AnimationClip rageAnim, LayerMask targetLayer, Collider2D collider) : base(parent) { this.moveRange = moveRange; this.pingPongVelocity = pingPongVelocity; this.rangeVelocity = rangeVelocity; this.targetLayer = targetLayer; this.col = collider; this.rageAnim = rageAnim; initPos = this.Parent.tf.position; rangeMove = new RangeRandomMove(this.moveRange, this.rangeVelocity, this.initPos, false); pingPongMove = new PingPongMove(this.pingPongVelocity, this.moveRange.x, initPos, true, false); //the init move will be pingPong currentMove = pingPongMove; rasg = Parent as RedAirStingray; }
// Use this for initialization void Start() { _pingPong = this.gameObject.GetComponent<PingPongMove>(); defaultScale = transform.localScale; }