Ejemplo n.º 1
0
 void Awake()
 {
     playerInputsController = player.GetComponent <InputsController>();
     platformMovements      = movingPlatform.GetComponent <PlatformMovements>();
     deadlyPlatformScript   = deadlyPlatform.GetComponent <DeadlyPlatform>();
     bouncingPlatformScript = bouncingPlatform.GetComponent <BouncingPlatform>();
 }
Ejemplo n.º 2
0
    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();
    }
Ejemplo n.º 3
0
    /// <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);
        }
    }
Ejemplo n.º 4
0
 void Start()
 {
     playerInputController = player.GetComponent <InputsController>();
 }
Ejemplo n.º 5
0
 override public void TriggerAction(InputsController player)
 {
     player.Die();
 }
Ejemplo n.º 6
0
 public abstract void TriggerAction(InputsController player);
Ejemplo n.º 7
0
 override public void TriggerAction(InputsController player)
 {
     endScreen.SetActive(true);
     Time.timeScale = 0f;
     Cursor.visible = true;
 }
Ejemplo n.º 8
0
 override public void TriggerAction(InputsController player)
 {
     SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
 }