Exemple #1
0
    // Use this for initialization
    protected override void Start()
    {
        // NAO CODIFICAR NESSA AREA. SOMENTE SE NECESSARIO
        base.Start();
        // Codifique daqui para baixo;

        myCamera = Camera.main;
        base.CharacterType = ENUMERATORS.Character.CharacterTypeEnum.Player;

        // Initialize o controle de skills
        PlayerSkillSet = new PlayerSkills();
        PlayerSkillSet.InitializePlayerSkills(this);

        CurrentGranade = null;

        _laserLineRenderer = GetComponent<LineRenderer>();

        if (_laserLineRenderer != null)
        {
            _laserLineRenderer.enabled = true;
            _laserPoint = new GameObject(string.Concat(this.name, "LaserSpotLight"), typeof(Light));
            _laserPoint.transform.SetParent(this.gameObject.transform);
            _laserPointLight = _laserPoint.GetComponent<Light>();
            _laserPointLight.type = LightType.Spot;
            _laserPointLight.enabled = true;
            _laserPointLight.shadows = LightShadows.None;
            _laserPointLight.color = _laserLineRenderer.material.GetColor("_EmissionColor");
            _laserPointLight.spotAngle = 20f;
            _laserPointLight.intensity = 4.5f;
            _laserPointLight.range = 1f;
            _laserPointLight.bounceIntensity = 0;

        }
    }
Exemple #2
0
 void Awake()
 {
     DontDestroyOnLoad(gameObject);
     CurrentGranade = null;
     PlayerInputController = GetComponent<PlayerInput>();
     SetInitialAttributes();
     SetupWeapons();
 }
Exemple #3
0
    /// <summary>
    /// Metodo responsavel por gerenciar as acoes do personagem
    /// </summary>
    void HandleActions()
    {
        OnIronSight = false;
        //IsShooting = false;

        if (PlayerInputController.ThrowGranadeActionIsPressed)
        {
            if (GranadeCount > 0)
            {
                if (CurrentGranade == null)
                {
                    CurrentGranade = ApplicationModel.Instance.GranadeTable[0].Pool.GetFromPool() as GranadeBase;
                }

                if (CurrentGranade != null)
                {
                    CurrentGranade.CookGranade();
                }
            }
        }
        else
        {
            if (PlayerInputController.ThrowGranadeActionWasRelease && CurrentGranade != null)
            {
                CurrentGranade.transform.position = transform.position + Vector3.up * 2f;
                CurrentGranade.ThrowGranade(transform.forward);
				//<AudioSource> ().PlayOneShot(base.audio[0]);
                CurrentGranade = null;
                GranadeCount--;
            }

            OnIronSight = PlayerInputController.AimActionIsPressed;

            // Handle Skills
            if (PlayerInputController.SkillSlot1_WasPressed)
            {
                PlayerSkillSet.PerformSkill(PlayerSkills.DPADController.LEFT);
				if (PlayerSkillSet.skillon) {
					GetComponent<AudioSource> ().PlayOneShot (skill);
					PlayerSkillSet.skillon = false;
				}
            }
            else if (PlayerInputController.SkillSlot2_WasPressed)
            {
                PlayerSkillSet.PerformSkill(PlayerSkills.DPADController.RIGHT);
            }
        }

        if (CurrentWeapon != null)
        {
            if (PlayerInputController.ShootActionIsPressed)
                CurrentWeapon.TriggerPressed();

            if (PlayerInputController.ShootActionWasPressed)
                CurrentWeapon.TriggerWasPressed();

            if (PlayerInputController.ReloadActionWasPressed)
            {
                CurrentWeapon.Reload();
            }

            // Se estiver carregando nao pode olhar na mira
            OnIronSight = OnIronSight && !CurrentWeapon.IsReloading;
        }
    }