protected override void Awake()
 {
     base.Awake();
     AnimationControl = CharacterBodyParts.AnimationControl;
     CamControl       = CharacterBodyParts.FirstPersonCameraControl;
     PlayerInputs     = new WorldTriggerInputs();
     PlayerInputs.Enable();
     PlayerInputs.Player.Move.performed      += ctx => OnMove(ctx);
     PlayerInputs.Player.Look.performed      += ctx => OnLook(ctx);
     PlayerInputs.Player.Melee.performed     += ctx => OnMelee(ctx);
     PlayerInputs.Player.Jump.performed      += ctx => OnJump(ctx);
     PlayerInputs.Player.LeanLeft.performed  += ctx => OnLeanLeft(ctx);
     PlayerInputs.Player.LeanRight.performed += ctx => OnLeanRight(ctx);
     PlayerInputs.Player.Attach.performed    += ctx => OnAttach(ctx);
     PlayerInputs.Player.Prone.performed     += ctx => OnProne(ctx);
     PlayerInputs.Player.Crouch.performed    += ctx => OnCrouch(ctx);
     PlayerInputs.Player.SwapToMainTriggerSlot1.performed     += ctx => OnSwapToMainTriggerSlot1(ctx);
     PlayerInputs.Player.SwapToMainTriggerSlot2.performed     += ctx => OnSwapToMainTriggerSlot2(ctx);
     PlayerInputs.Player.SwapToMainTriggerSlot3.performed     += ctx => OnSwapToMainTriggerSlot3(ctx);
     PlayerInputs.Player.SwapToMainTriggerSlot4.performed     += ctx => OnSwapToMainTriggerSlot4(ctx);
     PlayerInputs.Player.SwaptoSubTrigger1.performed          += ctx => OnSwaptoSubTrigger1(ctx);
     PlayerInputs.Player.SwaptoSubTrigger2.performed          += ctx => OnSwaptoSubTrigger2(ctx);
     PlayerInputs.Player.SwaptoSubTrigger3.performed          += ctx => OnSwaptoSubTrigger3(ctx);
     PlayerInputs.Player.SwaptoSubTrigger4.performed          += ctx => OnSwaptoSubTrigger4(ctx);
     PlayerInputs.Player.ToggleSwapRightMainTrigger.performed += ctx => OnToggleSwapRightMainTrigger(ctx);
     PlayerInputs.Player.ToggleSwapLeftMainTrigger.performed  += ctx => OnToggleSwapLeftMainTrigger(ctx);
     PlayerInputs.Player.ToggleSwapRightSubTrigger.performed  += ctx => OnToggleSwapRightSubTrigger(ctx);
     PlayerInputs.Player.ToggleSwapLeftSubTrigger.performed   += ctx => OnToggleSwapLeftSubTrigger(ctx);
     PlayerInputs.Player.Info.performed   += ctx => OnInfo(ctx);
     PlayerInputs.Player.Menu.performed   += ctx => OnMenu(ctx);
     PlayerInputs.Player.Sprint.performed += ctx => OnSprint(ctx);
 }
 void Awake()
 {
     weaponDuo = GameObject.Find("WeaponDuo");
     playerAnimControlScript = GameObject.Find("Player").GetComponent <PlayerAnimationControl> ();
     playerMovementScript    = GameObject.Find("Player").GetComponent <PlayerMovement> ();
     canShoot = true;
 }
示例#3
0
    private void Awake()
    {
        // Cache input and animator control
        playerInput              = GetComponent <PlayerInput>();
        playerAnimationControl   = GetComponent <PlayerAnimationControl>();
        superCharacterController = GetComponent <SuperCharacterController>();
        // Cache animator and rigidbody
        anim = GetComponent <Animator>();
        rb   = GetComponent <Rigidbody>();
        // Get the camera transform
        m_Cam = playerCamera.transform;

        /*
         * // Get third person character reference
         * m_Character = GetComponent<ThirdPersonCharacter>();
         */
        // Set the current state to idle
        currentState         = CharacterState.Idle;
        playerCharacterState = CharacterState.Idle;

        if (currentItem == CharacterItem.Sword)
        {
            anim.SetInteger("Weapon", 1);
            anim.SetTrigger("WeaponUnsheathTrigger");
        }
        //Idle_EnterState();
        // Make it live!
        isAlive = true;
    }
示例#4
0
 void Start()
 {
     rb        = GetComponent <Rigidbody>();
     startDrag = rb.drag;
     bodySurfaceLandControl = GetComponent <BodySurfaceLandControl>();
     anim         = GetComponent <PlayerAnimationControl>();
     soundControl = SoundControl.Instance;
 }
示例#5
0
 protected override void Start()
 {
     base.Start();
     playerAnimator = (PlayerAnimationControl)GetComponent(typeof(PlayerAnimationControl));
     if (playerAnimator != null)
     {
         playerAnimator.Initialization(this);
     }
 }
示例#6
0
    private void Start()
    {
        movement  = GetComponent <PlayerMovement>();
        combat    = GetComponentInChildren <PlayerCombat>();
        anim      = GetComponentInChildren <PlayerAnimationControl>();
        stats     = GetComponent <PlayerStats>();
        dialogues = GetComponent <DialogueControl>();

        SaveManager.LoadGame();
    }
示例#7
0
 void Start()
 {
     facingRight             = true;
     speed                   = 12f;
     jumpForce               = 500f;
     playerRigid             = GetComponent <Rigidbody2D> ();
     spriteRenderer          = GetComponent <SpriteRenderer> ();
     isJumping               = false;
     isKneeing               = false;
     playerAnimControlScript = this.gameObject.GetComponent <PlayerAnimationControl> ();
 }
示例#8
0
	// Use this for initialization
	void Start () {
		aniControlScript = (PlayerAnimationControl)this.transform.FindChild("Male001").GetComponent<PlayerAnimationControl>();
		
		moveBaseScript = (PlayerMoveBase)this.GetComponent<PlayerMoveBase>();
		
		directionIcon = this.transform.FindChild("icon");
		specialAttackIcon = this.transform.FindChild("SpecialAttackIcon");
		
        player = gameObject.AddComponent<Player>();
        player.Init(1000);
        SceneMng.instance.AddMainPlayer(player);
	}
    // Use this for initialization
    protected override void Start()
    {
        base.Start();

        iManager = FindObjectOfType <InputManager>();
        if (iManager)
        {
            iManager.SetCharacter(playerNumber, this);
        }

        m_animationControl = GetComponentInChildren <PlayerAnimationControl>();

        //REMOVE
        SetWeapon(m_Weapon);
    }
示例#10
0
    void Start()
    {
        if (Application.loadedLevelName == "LevelCompleteScene" || Application.loadedLevelName == "MainMenu" || Application.loadedLevelName == "DeathMenu" || Application.loadedLevelName == "InformationScene" || Application.loadedLevelName == "GameCompleteScene")
        {
            return;
        }

        GameObject             player = GameObject.Find("Player");
        PlayerMovement         playerMovementScript    = player.GetComponent <PlayerMovement> ();
        PlayerAnimationControl playerAnimControlScript = player.GetComponent <PlayerAnimationControl> ();

        textAlert = this.gameObject.GetComponentInChildren <TextAlert> ();
        HealthBarLogic playerHealthBar = GameObject.Find("HealthBar").GetComponent <HealthBarLogic> ();

        if (Application.loadedLevelName == "Level5")
        {
            StartCoroutine(Level5Intro());
        }

        Button[] buttons = gameObject.GetComponentsInChildren <Button> ();

//		buttons [0].onClick.AddListener (() => {
//			//playerMovementScript.OnLeftButtonClick();
//		});

        buttons [1].onClick.AddListener(() => {
            playerAnimControlScript.OnButtonDownClick();
        });

//		buttons [2].onClick.AddListener (() => {
//			//playerMovementScript.OnRightButtonClick();
//		});

        buttons [3].onClick.AddListener(() => {
            playerAnimControlScript.OnUpButtonClick();
        });

        buttons [4].onClick.AddListener(() => {
            playerMovementScript.OnStopMovingClick();
        });

        buttons [5].onClick.AddListener(() => {
            playerAnimControlScript.OnShootButtonClick();
        });

        buttons [6].onClick.AddListener(() => {
            playerMovementScript.OnJumpButtonClick();
        });

        buttons [7].onClick.AddListener(() => {
            //ShieldBuy
            if (HealthBarLogic.alreadyDead)
            {
                return;
            }

            if (PlayerScore.money >= 15)
            {
                if (playerHealthBar.shieldAmount < 100)
                {
                    playerHealthBar.ShieldPlayer(50, 6);
                    PlayerScore.money -= 15;
                }
                else
                {
                    textAlert.ShowMessage("Нямате нужда от това в момента!");
                }
            }
            else
            {
                textAlert.ShowMessage("Нямате достатъчно пари, за да закупите това!");
            }
        });

        buttons [8].onClick.AddListener(() => {
            //HealthBuy
            if (HealthBarLogic.alreadyDead)
            {
                return;
            }

            if (PlayerScore.money >= 20)
            {
                if (playerHealthBar.Health == 100)
                {
                    textAlert.ShowMessage("Вече сте на пълни жизнени точки!");
                    return;
                }

                playerHealthBar.HealPlayer(40);
                PlayerScore.money -= 20;
            }
            else
            {
                textAlert.ShowMessage("Нямате достатъчно пари, за да закупите това!");
            }
        });

        buttons [9].onClick.AddListener(() => {
            //TimeSlowerBuy
            if (HealthBarLogic.alreadyDead)
            {
                return;
            }

            if (PlayerScore.money >= 10)
            {
                if (GameObject.Find("TimeSlowerGO") != null)
                {
                    textAlert.ShowMessage("Вече сте използвали този ефект!");
                }
                else
                {
                    GameObject timeSlowerGO = new GameObject("TimeSlowerGO");
                    timeSlowerGO.AddComponent <CollectablesLogic>();
                    StartCoroutine(timeSlowerGO.GetComponent <CollectablesLogic>().TimeSlower());
                    PlayerScore.money -= 10;
                }
            }
            else
            {
                textAlert.ShowMessage("Нямате достатъчно пари, за да закупите това!");
            }
        });

        buttons [10].onClick.AddListener(() => {
            //RocketLauncherBuy
            if (HealthBarLogic.alreadyDead)
            {
                return;
            }

            if (PlayerScore.money >= 50)
            {
                if (playerAnimControlScript.isKneeingButtonClicked)
                {
                    playerAnimControlScript.OnUpButtonClick();
                }

                if (playerMovementScript.facingRight)
                {
                    Instantiate(rocketLauncher, player.gameObject.transform.position - new Vector3(0, 0.1f, 0), Quaternion.Euler(0, 180, 0));
                }
                else if (playerMovementScript.facingRight == false)
                {
                    Instantiate(rocketLauncher, player.gameObject.transform.position - new Vector3(0, 0.1f, 0), Quaternion.Euler(0, 0, 0));
                }

                PlayerScore.money -= 50;
            }
            else
            {
                textAlert.ShowMessage("Нямате достатъчно пари, за да закупите това!");
            }
        });
    }
示例#11
0
    // Use this for initialization
    void Start()
    {
        aniControlScript = (PlayerAnimationControl)this.transform.FindChild("character").GetComponent<PlayerAnimationControl>();

        moveBaseScript = (PlayerMoveBase)this.GetComponent<PlayerMoveBase>();

        colliderBaseScript = (PlayerColliderBase)this.GetComponent<PlayerColliderBase>();
    }
 void Start()
 {
     animControl         = GetComponent <PlayerAnimationControl>();
     shootingControl     = GetComponent <PlayerShootingControl>();
     characterController = GetComponent <CharacterController>();
 }
示例#13
0
 void Start()
 {
     invoker     = GameObject.Find("Main").GetComponent <Invoker>();
     animControl = GetComponent <PlayerAnimationControl>();
 }