override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (!Parent) { Parent = animator.GetComponent <RedAirStingray> ( ); randMove = new RangeRandomMove(range, speed, Parent.InitPos); } }
public JellyfishMovement(Enemy parent, float speed, float traceSpeed, Vector2 range, float detectAreaRadius, float minDistance, LayerMask targetLayer) : base(parent) { //set initPosition to jellyfish current position initPos = Parent.tf.position; this.speed = speed; this.range = range; this.detectAreaRadius = detectAreaRadius; this.traceSpeed = traceSpeed; this.targetLayer = targetLayer; this.minDistance = minDistance; rangeMove = new RangeRandomMove(range, speed, initPos); traceMove = new FreeTraceMove(traceSpeed, target, Parent.tf.position, minDistance); currentMove = rangeMove; }
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; }