public void Update(ActionNode node, float deltaTime) { MoveConfig config = (MoveConfig)node.config; IActionMachine machine = node.actionMachine; ActionMachineController controller = (ActionMachineController)node.actionMachine.controller; if (InputData.HasEvent(InputEvents.Moving)) { var velocity = controller.rigid.velocity; var move = InputData.axisValue.normalized * config.moveSpeed; velocity.x = move.x; velocity.z = move.y; controller.rigid.velocity = velocity; } }
public void Update(ActionNode node, float deltaTime) { MoveConfig config = (MoveConfig)node.config; IActionMachine machine = node.actionMachine; IActionController controller = (IActionController)node.actionMachine.controller; Vector3 velocity = controller.velocity; if (machine.input.HasKey(controller.ID, (int)ActionKeyCode.Axis)) { InputData data = machine.input.GetRawInput(controller.ID); velocity = data.GetDir() * config.moveSpeed; controller.rotation = data.GetRotation(); } controller.velocity = new Vector3(velocity.x, controller.velocity.y, velocity.z); }
protected Player(string gameObjectName, string bulletPrefabName, float firePerFrame, float bulletMargin, int fireDamage) { this.moveConfig = new MoveConfig(); this.fireConfig = new FireConfig(); this.shieldConfig = new ShieldConfig(); this.gameObject = GameObject.Find(gameObjectName); this.gameObjectName = gameObjectName; this.fireConfig.bulletGameObject = (GameObject)Resources.Load("Scenes/Game/Prefabs/" + bulletPrefabName); this.fireConfig.firePerFrame = firePerFrame; this.fireConfig.margin = bulletMargin; this.fireConfig.damage = fireDamage; // バリアーを子オブジェクトとして生成する TODO プレハブを自機分ロードするのは無駄だが・・・ this.shieldConfig.shieldGameObject = (GameObject)Object.Instantiate((GameObject)Resources.Load("Scenes/Game/Prefabs/Player_shield"), this.gameObject.transform.position, Quaternion.identity); // 作成したオブジェクトを子として登録 this.shieldConfig.shieldGameObject.transform.parent = this.gameObject.transform; this.defaultScale = gameObject.transform.localScale; // 予測線 this.bulletLine = (GameObject)Object.Instantiate((GameObject)Resources.Load("Scenes/Game/Prefabs/ShotLine"), this.gameObject.transform.position, Quaternion.identity); this.bulletLine.transform.parent = this.gameObject.transform; this.bulletLine.transform.position = new Vector3(this.bulletLine.transform.position.x, this.bulletLine.transform.position.y + this.bulletLine.GetComponent <SpriteRenderer>().bounds.size.y / 2, 0); this.bulletLine.SetActive(false); }
public void Exit(ActionNode node) { MoveConfig config = (MoveConfig)node.config; IActionMachine machine = node.actionMachine; //IActionController controller = (IActionController)node.actionMachine.controller; }
public void SetConfig(MoveConfig config) { this.config = config; atTarget = false; SwitchToState(State.MoveToInitialTarget); }
public void SetMoveConfig(MoveConfig moveConfig) { _heroMoveControl.MoveConfig = moveConfig; }