public override void OnEntrance() { Debug.Log("Chara Enter Moving Deploying"); // Animator param.animator.SetTrigger("ToMoving"); param.chara.shooter.eventOnMarkActivated += ToFastMoving; param.chara.shooter.eventOnMarkBouncingBack += ToMovingRetrieving; // Move Vector3 dir = MovementHelper.GetMovement(); if (dir.magnitude >= param.chara.thresMove) { dir = MovementHelper.NormalizeAndScaleMovementByTime(dir); MovingDirection mdirCur = MovementHelper.GetMovingDirection(dir); if (mdirCur != mdirLast) { Character.SwitchMovingAnimationState(mdirCur, param.animator); mdirLast = mdirCur; } param.chara.controller.Move(dir); } }
public override IState Update() { // Move Vector3 dir = MovementHelper.GetMovement(); if (dir.magnitude >= param.chara.thresMove) { dir = MovementHelper.NormalizeAndScaleMovementByTime(dir); MovingDirection mdirCur = MovementHelper.GetMovingDirection(dir); if (mdirCur != mdirLast) { Character.SwitchMovingAnimationState(mdirCur, param.animator); mdirLast = mdirCur; } param.chara.controller.Move(dir); } else { return(new StateCharaIdleDeploying(param)); // StateCharaIdleDeploying } if (toTransitToFastMoving) { return(new StateCharaFastMoving(param)); // StateCharaFastMoving } if (toTransitToMovingRetrieving) { return(new StateCharaMovingRetrieving(param)); // StateCharaMovingRetrieving } return(null); }
public override IState Update() { // Move Vector3 dir = MovementHelper.GetMovement(); if (dir.magnitude >= param.chara.thresMove) { dir = MovementHelper.NormalizeAndScaleMovementByTime(dir); MovingDirection mdirCur = MovementHelper.GetMovingDirection(dir); if (mdirCur != mdirLast) { Character.SwitchMovingAnimationState(mdirCur, param.animator); mdirLast = mdirCur; } param.chara.controller.Move(dir); } else { return(new StateCharaIdle(param)); // StateCharaIdle } // Shoot if (Input.GetMouseButtonDown(0)) { if (param.chara.shooter.MarkInstance == null) { Vector3 posMouse = Input.mousePosition; Vector3 posW = Camera.main.ScreenToWorldPoint(posMouse); posW.z = 0; param.chara.shooter.Deploy(posW); return(new StateCharaMovingDeploying(param)); // StateCharaMovingDeploying } } return(null); }
public override IState Update() { // Move Vector3 dir = MovementHelper.GetMovement(); if (dir.magnitude >= param.chara.thresMove) { dir = MovementHelper.NormalizeAndScaleMovementByTime(dir); MovingDirection mdirCur = MovementHelper.GetMovingDirection(dir); if (mdirCur != mdirLast) { Character.SwitchMovingAnimationState(mdirCur, param.animator); mdirLast = mdirCur; } param.chara.controller.Move(dir); } else { return(new StateCharaIdleDeployed(param)); // StateCharaIdleDeployed } // SMOKE durTime += Time.deltaTime; if (durTime >= durMakeSmoke) { GameObject.Instantiate(param.chara.goSmoke, param.chara.transSmoke.position, Quaternion.identity); durTime -= durMakeSmoke; } // Retrieve if (Input.GetMouseButtonDown(0) || toTransitToMovingRetrieving) { param.chara.shooter.Retrieve(); return(new StateCharaMovingRetrieving(param)); // StateCharaMovingRetrieving } return(null); }