void Awake() { playerInputsController = player.GetComponent <InputsController>(); platformMovements = movingPlatform.GetComponent <PlatformMovements>(); deadlyPlatformScript = deadlyPlatform.GetComponent <DeadlyPlatform>(); bouncingPlatformScript = bouncingPlatform.GetComponent <BouncingPlatform>(); }
private void Awake() { MyTransform = transform; Inputs = new InputsController(); Inputs.Player.Shoot.started += _ => UpdateShoot(true); Inputs.Player.Shoot.canceled += _ => UpdateShoot(false); Inputs.Player.Move.performed += ctx => UpdateDirection(ctx.ReadValue <Vector2>()); Inputs.Player.Move.canceled += ctx => UpdateDirection(ctx.ReadValue <Vector2>()); Inputs.Player.ShootDirection.performed += ctx => UpdateShootDirection(ctx.ReadValue <Vector2>()); Inputs.Player.ShootDirection.canceled += ctx => UpdateShootDirection(ctx.ReadValue <Vector2>()); Inputs.Player.ChangeMode.performed += _ => ChangeMode(); }
/// <summary> /// Создание игрока на сцене /// </summary> public void CreatePlayer(Vector3 pos, Vector3 inputPos, int _id) { mapController = GetComponent <MapController>(); player = Instantiate(playerPref, pos, Quaternion.identity, transform).transform; playerRender = player.GetComponent <SpriteRenderer>(); Transform canvas = GameObject.Find("Canvas").transform; input = Instantiate(inputPrefab, inputPos, Quaternion.identity, canvas).GetComponent <InputsController>(); id = _id; if (isLocalPlayer) { currentPos = mapController.beginPoint; mapController.Map[currentPos.y, currentPos.x].OpenTile(); CmdStep(mapController.beginPoint.x, mapController.beginPoint.y); } }
void Start() { playerInputController = player.GetComponent <InputsController>(); }
override public void TriggerAction(InputsController player) { player.Die(); }
public abstract void TriggerAction(InputsController player);
override public void TriggerAction(InputsController player) { endScreen.SetActive(true); Time.timeScale = 0f; Cursor.visible = true; }
override public void TriggerAction(InputsController player) { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); }