コード例 #1
0
    private void OnEnable()
    {
        m_ProjectileBase = GetComponent <ProjectileBase>();
        DebugUtility.HandleErrorIfNullGetComponent <ProjectileBase, ProjectileChargeParameters>(m_ProjectileBase, this, gameObject);

        m_ProjectileBase.onShoot += OnShoot;
    }
コード例 #2
0
    void Start()
    {
        m_Objective = GetComponent <Objective>();
        DebugUtility.HandleErrorIfNullGetComponent <Objective, ObjectiveKillEnemies>(m_Objective, this, gameObject);

        m_EnemyManager = FindObjectOfType <EnemyManager>();
        DebugUtility.HandleErrorIfNullFindObject <EnemyManager, ObjectiveKillEnemies>(m_EnemyManager, this);
        m_EnemyManager.onRemoveEnemy += OnKillEnemy;

        if (mustKillAllEnemies)
        {
            killsToCompleteObjective = m_EnemyManager.numberOfEnemiesTotal;
        }


        // set a title and description specific for this type of objective, if it hasn't one
        if (string.IsNullOrEmpty(m_Objective.title))
        {
            m_Objective.title = "Eliminate " + (mustKillAllEnemies ? "all the" : killsToCompleteObjective.ToString()) + " enemies";
        }

        if (string.IsNullOrEmpty(m_Objective.description))
        {
            m_Objective.description = GetUpdatedCounterAmount();
        }
    }
コード例 #3
0
    void Start()
    {
        CharacterStatsController stats = GetComponent <CharacterStatsController>();

        DebugUtility.HandleErrorIfNullGetComponent <CharacterStatsController, EnemyManager>(stats, this, gameObject);
        stats.onHealthChanged += HookDamage;
    }
コード例 #4
0
ファイル: CrosshairManager.cs プロジェクト: LV9652/Sniper
        void OnWeaponChanged(WeaponController newWeapon)
        {
            if (newWeapon)
            {
                CrosshairImage.enabled   = true;
                m_CrosshairDataDefault   = newWeapon.CrosshairDataDefault;
                m_CrosshairDataTarget    = newWeapon.CrosshairDataTargetInSight;
                m_CrosshairRectTransform = CrosshairImage.GetComponent <RectTransform>();
                DebugUtility.HandleErrorIfNullGetComponent <RectTransform, CrosshairManager>(m_CrosshairRectTransform,
                                                                                             this, CrosshairImage.gameObject);
            }
            else
            {
                if (NullCrosshairSprite)
                {
                    CrosshairImage.sprite = NullCrosshairSprite;
                }
                else
                {
                    CrosshairImage.enabled = false;
                }
            }

            UpdateCrosshairPointingAtEnemy(true);
        }
コード例 #5
0
    void Start()
    {
        if (online)
        {
            m_Weapon_p = GetComponent <WeaponController_Photon>();
            DebugUtility.HandleErrorIfNullGetComponent <WeaponController_Photon, WeaponFuelCellHandler>(m_Weapon_p, this, gameObject);

            m_FuelCellsCooled = new bool[fuelCells.Length];
            for (int i = 0; i < m_FuelCellsCooled.Length; i++)
            {
                m_FuelCellsCooled[i] = true;
            }
        }
        else
        {
            m_Weapon = GetComponent <WeaponController>();
            DebugUtility.HandleErrorIfNullGetComponent <WeaponController, WeaponFuelCellHandler>(m_Weapon, this, gameObject);

            m_FuelCellsCooled = new bool[fuelCells.Length];
            for (int i = 0; i < m_FuelCellsCooled.Length; i++)
            {
                m_FuelCellsCooled[i] = true;
            }
        }
    }
コード例 #6
0
    private void OnEnable()
    {
        m_IteractiableBase = GetComponent <InteractableBase>();
        DebugUtility.HandleErrorIfNullGetComponent <InteractableBase, InteractionSkillPickup>(m_IteractiableBase, this, gameObject);

        m_IteractiableBase.onInteract += OnInteract;
    }
コード例 #7
0
ファイル: PlayerWeaponsManager.cs プロジェクト: LV9652/Sniper
        void Start()
        {
            ActiveWeaponIndex   = -1;
            m_WeaponSwitchState = WeaponSwitchState.Down;

            m_InputHandler = GetComponent <PlayerInputHandler>();
            DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, PlayerWeaponsManager>(m_InputHandler, this,
                                                                                                  gameObject);

            m_PlayerCharacterController = GetComponent <PlayerCharacterController>();
            DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, PlayerWeaponsManager>(
                m_PlayerCharacterController, this, gameObject);

            SetFov(DefaultFov);

            OnSwitchedToWeapon += OnWeaponSwitched;

            // Add starting weapons
            foreach (var weapon in StartingWeapons)
            {
                AddWeapon(weapon);
            }

            SwitchWeapon(true);
        }
コード例 #8
0
    public void RegisterObjective(Objective objective)
    {
        objective.onUpdateObjective += OnUpdateObjective;

        // instanciate the Ui element for the new objective
        GameObject objectiveUIInstance = objective.isOptional ? secondaryObjectivePrefab.getObject(true, objectivePanel.transform) : primaryObjectivePrefab.getObject(true, objectivePanel.transform);

        if (!objective.isOptional)
        {
            objectiveUIInstance.transform.SetSiblingIndex(0);
        }

        ObjectiveToast toast = objectiveUIInstance.GetComponent <ObjectiveToast>();

        DebugUtility.HandleErrorIfNullGetComponent <ObjectiveToast, ObjectiveHUDManger>(toast, this, objectiveUIInstance.gameObject);

        // initialize the element and give it the objective description
        toast.Initialize(objective.title, objective.description, objective.GetUpdatedCounterAmount(), objective.isOptional, objective.delayVisible);

        m_ObjectivesDictionary.Add(objective, toast);

        if (showObjectivePanel)
        {
            objectivePanel.UpdateTable(toast.gameObject);
        }
    }
コード例 #9
0
    private void Start()
    {
        inter = GetComponent <Interact>();

        activeWeaponIndex   = -1;
        m_WeaponSwitchState = WeaponSwitchState.Down;

        m_InputHandler = GetComponent <PlayerInputHandler>();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, PlayerWeaponsManager>(m_InputHandler, this, gameObject);

        m_PlayerCharacterController = GetComponent <PlayerCharacterController>();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, PlayerWeaponsManager>(m_PlayerCharacterController, this, gameObject);

        SetFOV(defaultFOV);

        onSwitchedToWeapon += OnWeaponSwitched;

        startingWeapons = startingWeapons.Where(x => x != null).ToList();

        // Add starting weapons
        foreach (var weapon in startingWeapons)
        {
            AddWeapon(weapon);
        }
        SwitchWeapon(true);
    }
コード例 #10
0
        void Awake()
        {
            coolingEvent = FMODUnity.RuntimeManager.CreateInstance(CoolingCellsSound);

            var emissionModule = SteamVfx.emission;

            emissionModule.rateOverTimeMultiplier = 0f;

            m_OverheatingRenderersData = new List <RendererIndexData>();
            foreach (var renderer in GetComponentsInChildren <Renderer>(true))
            {
                for (int i = 0; i < renderer.sharedMaterials.Length; i++)
                {
                    if (renderer.sharedMaterials[i] == OverheatingMaterial)
                    {
                        m_OverheatingRenderersData.Add(new RendererIndexData(renderer, i));
                    }
                }
            }

            m_OverheatMaterialPropertyBlock = new MaterialPropertyBlock();
            m_SteamVfxEmissionModule        = SteamVfx.emission;

            m_Weapon = GetComponent <WeaponController>();
            DebugUtility.HandleErrorIfNullGetComponent <WeaponController, OverheatBehavior>(m_Weapon, this, gameObject);

            /*m_AudioSource = gameObject.AddComponent<AudioSource>();
             * m_AudioSource.clip = CoolingCellsSound;
             * m_AudioSource.outputAudioMixerGroup = AudioUtility.GetAudioGroup(AudioUtility.AudioGroups.WeaponOverheat);*/
        }
コード例 #11
0
    void Start()
    {
        // fetch components on the same gameObject
        m_Controller = GetComponent <CharacterController> ();
        DebugUtility.HandleErrorIfNullGetComponent <CharacterController, PlayerCharacterController> (m_Controller, this, gameObject);

        m_ClimbController = GetComponent <PlayerClimbController> ();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerClimbController, PlayerCharacterController> (m_ClimbController, this, gameObject);

        m_WalkController = GetComponent <PlayerWalkController> ();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerWalkController, PlayerCharacterController> (m_WalkController, this, gameObject);

        m_InputHandler = GetComponent <PlayerInputHandler> ();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, PlayerCharacterController> (m_InputHandler, this, gameObject);

        m_WeaponsManager = GetComponent <PlayerWeaponsManager> ();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerWeaponsManager, PlayerCharacterController> (m_WeaponsManager, this, gameObject);

        m_Health = GetComponent <Health> ();
        DebugUtility.HandleErrorIfNullGetComponent <Health, PlayerCharacterController> (m_Health, this, gameObject);

        m_Actor = GetComponent <Actor> ();
        DebugUtility.HandleErrorIfNullGetComponent <Actor, PlayerCharacterController> (m_Actor, this, gameObject);

        mainCamera      = Camera.main;
        interactionText = GameObject.Find("InteractionCanvas/InteractionText").GetComponent <Text> ();

        m_Health.onDie += OnDie;

        // force the crouch state to false when starting
        SetCrouchingState(false, true);
    }
コード例 #12
0
    void Start()
    {
        m_PlayerInputsHandler = FindObjectOfType <PlayerInputHandler>();
        DebugUtility.HandleErrorIfNullFindObject <PlayerInputHandler, InGameMenuManager>(m_PlayerInputsHandler, this);

        m_PlayerHealth = m_PlayerInputsHandler.GetComponent <Health>();
        DebugUtility.HandleErrorIfNullGetComponent <Health, InGameMenuManager>(m_PlayerHealth, this, gameObject);

        m_FramerateCounter = FindObjectOfType <FramerateCounter>();
        DebugUtility.HandleErrorIfNullFindObject <FramerateCounter, InGameMenuManager>(m_FramerateCounter, this);

        menuRoot.SetActive(false);

        lookSensitivitySlider.value = m_PlayerInputsHandler.lookSensitivity;
        lookSensitivitySlider.onValueChanged.AddListener(OnMouseSensitivityChanged);

        shadowsToggle.isOn = QualitySettings.shadows != ShadowQuality.Disable;
        shadowsToggle.onValueChanged.AddListener(OnShadowsChanged);

        invincibilityToggle.isOn = m_PlayerHealth.invincible;
        invincibilityToggle.onValueChanged.AddListener(OnInvincibilityChanged);

        framerateToggle.isOn = m_FramerateCounter.uiText.gameObject.activeSelf;
        framerateToggle.onValueChanged.AddListener(OnFramerateCounterChanged);
    }
コード例 #13
0
    void Start()
    {
        // fetch components on the same gameObject
        m_Controller = GetComponent <CharacterController>();
        DebugUtility.HandleErrorIfNullGetComponent <CharacterController, IS_PlayerCharacterController>(m_Controller, this, gameObject);

        m_InputHandler = GetComponent <IS_PlayerInputHandler>();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, IS_PlayerCharacterController>(m_InputHandler, this, gameObject);

        m_WeaponsManager = GetComponent <IS_PlayerWeaponsManager>();
        DebugUtility.HandleErrorIfNullGetComponent <IS_PlayerWeaponsManager, IS_PlayerCharacterController>(m_WeaponsManager, this, gameObject);

        m_Health = GetComponent <Health>();
        DebugUtility.HandleErrorIfNullGetComponent <Health, IS_PlayerCharacterController>(m_Health, this, gameObject);

        m_Actor = GetComponent <Actor>();
        DebugUtility.HandleErrorIfNullGetComponent <Actor, IS_PlayerCharacterController>(m_Actor, this, gameObject);

        m_Controller.enableOverlapRecovery = true;

        m_Health.onDie += OnDie;

        // force the crouch state to false when starting
        SetCrouchingState(false, true);
        UpdateCharacterHeight(true);
    }
コード例 #14
0
    void Start()
    {
        timerActive = true;

        checkpoints.Add(transform.position);

        v.profile.TryGetSettings(out lensdis);
        v.profile.TryGetSettings(out vignett);
        v.profile.TryGetSettings(out chrome);

        // fetch components on the same gameObject
        m_Controller = GetComponent <CharacterController>();
        DebugUtility.HandleErrorIfNullGetComponent <CharacterController, PlayerCharacterController>(m_Controller, this, gameObject);

        m_InputHandler = GetComponent <PlayerInputHandler>();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, PlayerCharacterController>(m_InputHandler, this, gameObject);

        wallRunComponent = GetComponent <WallRun>();

        m_Controller.enableOverlapRecovery = true;

        // force the crouch state to false when starting
        SetCrouchingState(false, true);
        UpdateCharacterHeight(true);
    }
コード例 #15
0
    private void OnEnable()
    {
        m_ProjectileBase = GetComponent <ProjectileBase>();
        DebugUtility.HandleErrorIfNullGetComponent <ProjectileBase, SpeedBoostSpell>(m_ProjectileBase, this, gameObject);

        m_ProjectileBase.onShoot += OnShoot;
        Destroy(gameObject, 1);
    }
コード例 #16
0
    // Start is called before the first frame update
    void Start()
    {
        m_Objective = GetComponent <Objective>();
        DebugUtility.HandleErrorIfNullGetComponent <Objective, ObjectiveKillEnemies>(m_Objective, this, gameObject);

        health        = objectiveEnemy.GetComponent <Health>();
        health.onDie += CompleteObjective;
    }
コード例 #17
0
    void OnShoot()
    {
        CharacterStatsController statsController = m_ProjectileBase.owner.GetComponent <CharacterStatsController>();

        DebugUtility.HandleErrorIfNullGetComponent <CharacterStatsController, SpeedBoostSpell>(statsController, this, gameObject);

        statsController.moveSpeed.AddTemporaryModifier(speed, duration);
    }
コード例 #18
0
    private void Start()
    {
        m_Collider = GetComponent <Collider>();
        DebugUtility.HandleErrorIfNullGetComponent <Collider, Pickup>(m_Collider, this, gameObject);

        // ensure the physics setup is a kinematic rigidbody trigger
        m_Collider.isTrigger = true;
    }
コード例 #19
0
    // Start is called before the first frame update
    void Start()
    {
        m_PlayerCharacterController = GetComponent <PlayerCharacterController>();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, PlayerInputHandler>(m_PlayerCharacterController, this, gameObject);

        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;
    }
コード例 #20
0
    void Awake()
    {
        m_CurrentAmmo        = maxAmmo;
        m_LastMuzzlePosition = weaponMuzzle.position;

        m_ShootAudioSource = GetComponent <AudioSource>();
        DebugUtility.HandleErrorIfNullGetComponent <AudioSource, WeaponController>(m_ShootAudioSource, this, gameObject);
    }
コード例 #21
0
    void Start()
    {
        m_Pickup = GetComponent <Pickup>();
        DebugUtility.HandleErrorIfNullGetComponent <Pickup, GravityPickup>(m_Pickup, this, gameObject);

        // Subscribe to pickup action
        m_Pickup.onPick += OnPicked;
    }
コード例 #22
0
    private void Start()
    {
        m_CharacterStatsController = character.GetComponent <CharacterStatsController>();
        DebugUtility.HandleErrorIfNullGetComponent <CharacterStatsController, HealthBarController>(m_CharacterStatsController, this, gameObject);

        SetHealthBarMaxValue(m_CharacterStatsController.maxHealth.GetValue());
        m_CharacterStatsController.onHealthChanged += HandleHealthChange;
    }
コード例 #23
0
ファイル: Treasure.cs プロジェクト: daniellanikov/unity
        void Start()
        {
            m_PlayerCharacterController = GetComponent <PlayerCharacterController>();
            DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, Treasure>(m_PlayerCharacterController,
                                                                                             this, gameObject);

            m_InputHandler = GetComponent <PlayerInputHandler>();
            DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, Treasure>(m_InputHandler, this, gameObject);
        }
コード例 #24
0
    void Start()
    {
        m_Health = GetComponent <Health>();
        DebugUtility.HandleErrorIfNullGetComponent <Health, Destructable>(m_Health, this, gameObject);

        // Subscribe to damage & death actions
        m_Health.onDie     += OnDie;
        m_Health.onDamaged += OnDamaged;
    }
コード例 #25
0
    private void Start()
    {
        PlayerCharacterController playerCharacterController = GameObject.FindObjectOfType <PlayerCharacterController> ();

        DebugUtility.HandleErrorIfNullFindObject <PlayerCharacterController, PlayerHealthBar> (playerCharacterController, this);

        m_PlayerHealth = playerCharacterController.GetComponent <Health> ();
        DebugUtility.HandleErrorIfNullGetComponent <Health, PlayerHealthBar> (m_PlayerHealth, this, playerCharacterController.gameObject);
    }
コード例 #26
0
    private void OnEnable()
    {
        m_ProjectileBase = GetComponent <ProjectileBase>();
        DebugUtility.HandleErrorIfNullGetComponent <ProjectileBase, ProjectileStandard>(m_ProjectileBase, this, gameObject);

        m_ProjectileBase.onShoot += OnShoot;

        Destroy(gameObject, maxLifeTime);
    }
コード例 #27
0
    void Start()
    {
        // get pickup component on same instance
        m_Pickup = GetComponent <Pickup>();
        DebugUtility.HandleErrorIfNullGetComponent <Pickup, HealthPickup>(m_Pickup, this, gameObject);

        // Subscribe to pickup action
        m_Pickup.onPick += OnPicked;
    }
コード例 #28
0
    private void Start()
    {
        m_PlayerCharacterController = GetComponent <PlayerCharacterController>();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, PlayerInputHandler>(m_PlayerCharacterController, this, gameObject);
        m_GameFlowManager = FindObjectOfType <GameFlowManager>();
        DebugUtility.HandleErrorIfNullFindObject <GameFlowManager, PlayerInputHandler>(m_GameFlowManager, this);

        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;
    }
コード例 #29
0
    private void LateUpdate()
    {
        m_PlayerCharacterController = GetComponent <PlayerCharacterController>();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, PlayerInputHandler>(m_PlayerCharacterController, this, gameObject);
        m_GameFlowManager = FindObjectOfType <GameFlowManager>();
        DebugUtility.HandleErrorIfNullFindObject <GameFlowManager, PlayerInputHandler>(m_GameFlowManager, this);


        m_FireInputWasHeld = GetFireInputHeld();
    }
コード例 #30
0
    protected override void Start()
    {
        base.Start();

        m_AudioSource = GetComponent <AudioSource>();
        DebugUtility.HandleErrorIfNullGetComponent <AudioSource, EnemyMobile>(m_AudioSource, this, gameObject);

        m_CurrentScreenMaterial = m_TVRenderer.material;
        SetScreenTextures(m_IdleTexture, m_IdleEmissionTexture);
    }