コード例 #1
0
    void Start()
    {
        playerInput = GetComponent <ThirdPersonInput>();
        animator    = GetComponent <Animator>();

        cooldown = shootCooldown;
    }
        public virtual bool SetupThirdPersonInput()
        {
            bool continute_setup = false;

            AlertProgress("Checking ThirdPersonInput Dependencies");
            ThirdPersonInput thirdPersonInput = character.GetComponent <ThirdPersonInput>();

            if (thirdPersonInput)
            {
                AlertProgress("Character ThirdPersonInput Found");
                SetupThirdPersonInputDefaults(thirdPersonInput);
                continute_setup = true;
            }
            else
            {
                AlertProgress("ThirdPersonInput not found");
                AlertProgress("Creating ThirdPersonInput");
                thirdPersonInput = character.AddComponent <ThirdPersonInput>();
                SetupThirdPersonInputDefaults(thirdPersonInput);
                continute_setup = true;
            }

            AlertProgress("ThirdPersonInput Setup complete");
            return(continute_setup);
        }
コード例 #3
0
 public virtual void Awake()
 {
     m_transform        = GetComponent <Transform>();
     m_rigidbody        = GetComponent <Rigidbody>();
     m_capsuleCollider  = GetComponent <CapsuleCollider>();
     m_thirdPersonInput = GetComponent <ThirdPersonInput>();
 }
コード例 #4
0
    private void OnEnable()
    {
        playerInput = GetComponent <ThirdPersonInput>();
        photonView  = GetComponent <PhotonView>();
        myTeam      = GetComponent <PlayerTeam>();
        mechanim    = GetComponentInChildren <MecanimWrapper>();

        if (photonView.IsMine && PhotonNetwork.IsConnectedAndReady)
        {
            Messenger.AddListener <Vector3>(GameEvents.AUTO_SHOOT, CheckObstacles);
            Messenger.AddListener(GameEvents.RELOAD_PRESSED, Reload);
        }
    }
コード例 #5
0
    private void Awake()
    {
        if (personInput == null)
        {
            personInput = GetComponent <ThirdPersonInput>();
        }

        if (shootAbility == null)
        {
            shootAbility = GetComponent <ShootAbility>();
        }

        Messenger.AddListener(GameEvents.PAINTBALL_POWER_UP_PRESSED, PowerUp);
    }
コード例 #6
0
    /// <summary>
    ///     Find the character we want the HUD on
    /// </summary>
    /// <returns>
    ///     A boolean if we succesfully found the main character
    /// </returns>
    bool findCharacter()
    {
        if (!character)
        {
            Debug.LogError("The character was not added, attempting to resolve");
            character = FindObjectOfType <ThirdPersonInput>()?.transform.gameObject;
        }

        if (character)
        {
            characterInput = character.GetComponent <ThirdPersonInput>();
            return(true);
        }
        return(false);
    }
コード例 #7
0
    private bool shot;                  // a toggle for when we have shot the laser


    void Start()
    {
        // creating the two line renderers to initialise our variables
        laserL = new LineRenderer();
        laserR = new LineRenderer();

        // initialising eye positions
        EyeL = transform.Find("EyeL");
        EyeR = transform.Find("EyeR");

        // finding the BotControlScript on the root parent of the character
        botCtrl = GameObject.Find("ThirdPersonController").GetComponent <ThirdPersonInput>();
        // setting up the audio component
        GetComponent <AudioSource>().loop        = true;
        GetComponent <AudioSource>().playOnAwake = false;
    }
        public virtual void SetupThirdPersonInputDefaults(ThirdPersonInput thirdPersonInput)
        {
            if (thirdPersonInput == false)
            {
                return;
            }
            AlertProgress("Setting Default ThirdPersonInput values");

            TPCSTInputController inputController = character_defaults.inputController;

            thirdPersonInput.FastMovement          = inputController.FastMovement;
            thirdPersonInput.WalkWhenZooming       = inputController.WalkWhenZooming;
            thirdPersonInput.CameraOverride        = inputController.CameraOverride;
            thirdPersonInput.HorizontalRotateSpeed = inputController.HorizontalRotateSpeed;
            thirdPersonInput.VerticalRotateSpeed   = inputController.VerticalRotateSpeed;
            thirdPersonInput.ZoomRotateMultiplier  = inputController.ZoomRotateMultiplier;
            thirdPersonInput.RotateWhenUnlocked    = inputController.RotateWhenUnlocked;
            thirdPersonInput.DoubleTapDelay        = inputController.DoubleTapDelay;
            thirdPersonInput.CustomActions         = inputController.CustomActions;
            thirdPersonInput.Disabler = inputController.Disabler;

            AlertProgress("Setting Default ThirdPersonInput values complete");
        }
コード例 #9
0
ファイル: ItemManager.cs プロジェクト: yyj6120/portfolio_Rpg
        IEnumerator Start()
        {
            if (instance == null)
            {
                inventory = FindObjectOfType <Inventory>();
                instance  = this;

                if (!inventory && inventoryPrefab)
                {
                    inventory = Instantiate(inventoryPrefab);
                }

                if (!inventory)
                {
                    Debug.LogError("No vInventory assigned!");
                }

                if (inventory)
                {
                    inventory.GetItemsHandler = GetItems;
                    inventory.onEquipItem.AddListener(EquipItem);
                    inventory.onUnequipItem.AddListener(UnequipItem);
                    inventory.onDropItem.AddListener(DropItem);
                    inventory.onLeaveItem.AddListener(LeaveItem);
                    inventory.onUseItem.AddListener(UseItem);
                    inventory.onOpenCloseInventory.AddListener(OnOpenCloseInventory);
                }
                animator = GetComponent <Animator>();
                tpInput  = GetComponent <ThirdPersonInput>();

                if (dropItemsWhenDead)
                {
                    var character = GetComponent <Rpg.Character.Character>();
                    if (character)
                    {
                        character.onDead.AddListener(DropAllItens);
                    }
                }

                if (tpInput)
                {
                    tpInput.onUpdateInput.AddListener(UpdateInput);
                }

                var genericAction = GetComponent <GenericWarriorAction>();
                if (genericAction != null)
                {
                    genericAction.OnDoAction.AddListener(CollectItem);
                }

                yield return(new WaitForEndOfFrame());

                items = new List <Item>();
                if (itemListData)
                {
                    for (int i = 0; i < startItems.Count; i++)
                    {
                        AddItem(startItems[i], true);
                    }
                }
            }
        }
コード例 #10
0
 void Start()
 {
     _input    = GetComponent <ThirdPersonInput>();
     _movement = GetComponent <ThirdPersonMovement>();
     InitializeHPSlider();
 }
コード例 #11
0
 private void Awake()
 {
     input        = GetComponent <ThirdPersonInput>();
     shootAbility = GetComponent <ShootAbility>();
     photon       = GetComponent <PhotonView>();
 }