Inheritance: UnityEngine.MonoBehaviour
Exemplo n.º 1
0
    void Start()
    {
        fxAudioSource = GetComponent <AudioSource>();

        if (gameObject.CompareTag("Player"))
        {
            DontDestroyOnLoad(gameObject);


            playerCont  = GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
            charControl = GetComponent <CharacterController>();
            UpdateJumpSpeed();

            if (fist == null)
            {
                fist = GetComponentInChildren <Weapon>().gameObject;
            }
            weapons.Add(fist);
            activeWeapon = fist;
            InventoryManager.InspectionHolder = inspectionHolder;
        }

        GetCharAnimator();

        if (charAnimator != null)
        {
            charAnimator.runtimeAnimatorController = NPCManager.Instance.basicController;
        }

        InitBC(GameManager.CurrentScene);
    }
Exemplo n.º 2
0
    protected override void comeco()
    {
        if (pontP == null)
        {
            print(gameObject.name + "não apresenta script ponteiro");
        }
        else if (pontG == null)
        {
            print(gameObject.name + "não apresenta script ponteiro");
        }

        //colocando valores iniciais
        tempo      = 0;
        tempoAtivo = tempoAtivoMax / 2;
        //horaAtual = (int)tempoDeJogo/60 -1;

        plaFpc = pla.GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();

        pontP.comeco(GetComponent <Relogio>(), tempoDeJogo / 6);
        pontG.comeco(GetComponent <Relogio>(), tempoDeJogo / (6 * 12));

        //colocando os audios
        audioWinding         = gameObject.AddComponent(typeof(AudioSource)) as AudioSource;
        audioTick            = gameObject.AddComponent(typeof(AudioSource)) as AudioSource;
        audioTick.clip       = tickClip;
        audioBatidaHora      = gameObject.AddComponent(typeof(AudioSource)) as AudioSource;
        audioBatidaHora.clip = batidaClip;

        textInteragir = "Dar Corda";
        audioTick.Play();

        estatuaChorando = FindObjectOfType <cryingStatue>();
    }
Exemplo n.º 3
0
    void Start()
    {
        timerText   = GameObject.FindWithTag("hudTT").GetComponent <Text>();
        killCounter = GameObject.FindWithTag("hudKC").GetComponent <Text>();
        scoreText   = GameObject.FindWithTag("hudSC").GetComponent <Text>();

        sbKill           = GameObject.FindWithTag("sbKC").GetComponent <Text>();
        sbShots          = GameObject.FindWithTag("sbBC").GetComponent <Text>();
        sbTime           = GameObject.FindWithTag("sbTT").GetComponent <Text>();
        sbScore          = GameObject.FindWithTag("sbSC").GetComponent <Text>();
        sbShotPercentage = GameObject.FindWithTag("sbBP").GetComponent <Text>();
        sbHighScore      = GameObject.FindWithTag("sbHS").GetComponent <Text>();

        pControl = GameObject.FindWithTag("pControl").GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
        cControl = GameObject.FindWithTag("Player").GetComponent <CameraToggleController>();
        wSwitch  = GameObject.FindWithTag("wHolder").GetComponent <CS_WeaponSwitch>();
        wSwitch2 = GameObject.FindWithTag("wHolder2").GetComponent <CS_WeaponSwitch>();
        wCamera  = GameObject.FindWithTag("wCamera");
        hudUI    = GameObject.FindWithTag("HUD");

        newHS = GameObject.FindWithTag("newHS");
        pRank = GameObject.FindWithTag("sbRank").GetComponent <Text>();

        dManager = GameObject.FindWithTag("dManager").GetComponent <CS_DataManager>();

        StartMission();
        //	timerLimit = timerLimit* Time.deltaTime;
    }
 // Use this for initialization
 void Start()
 {
     myEvent    = GetComponent <EventBase>();
     controller = GameObject.FindGameObjectWithTag("Player").GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
     controller.setSpeed(walkSpeed);
     myEvent.setComplete();
 }
Exemplo n.º 5
0
    // Use this for initialization
    public Stamina()
    {
        JsonData root = SettingParser.Instance.SettingData;
        JsonData data = root["player"]["stamina"];

        MAX_STAMINA = float.Parse(data["maxStamina"].ToString());
        float percentage = float.Parse(data["penaltyLine(%)"].ToString()) * 0.01f;

        PENALTY_STAMINA            = MAX_STAMINA * percentage;
        CONSUME_SPEED_OF_RUN       = float.Parse(data["consumeSpeedOfRun"].ToString());
        CONSUME_SPEED_OF_SLOW_WALK = float.Parse(data["consumeSpeedOfSlowWalk"].ToString());
        RECOVERY_SPEED_OF_WALK     = float.Parse(data["recoverySpeedOfWalk"].ToString());
        RECOVERY_SPEED_OF_STOP     = float.Parse(data["recoverySpeedOfStop"].ToString());

        maxStaminaOfSpirit = MAX_STAMINA;
        currentStamina     = maxStaminaOfSpirit;
        penalty            = false;

        instructions = new InstructionStamina[(int)WALK_STATE.WALK_COUNT];
        instructions[(int)WALK_STATE.STOP]      = RecoverStaminaOfStop;
        instructions[(int)WALK_STATE.SLOW_WALK] = SpendStaminaOfSlowWalk;
        instructions[(int)WALK_STATE.WALK]      = RecoverStaminaOfWalk;
        instructions[(int)WALK_STATE.RUN]       = SpendStaminaOfRun;

        player = GameObject.FindGameObjectWithTag("Player")
                 .GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
    }
Exemplo n.º 6
0
 private void Start()
 {
     if (FPcontrol == null)
     {
         FPcontrol = FindObjectOfType <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
     }
 }
Exemplo n.º 7
0
 private void GameOver()
 {
     if (isGameOver() && lose)
     {
         fps               = GameObject.FindGameObjectWithTag("Player").GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController> ();
         fps.enabled       = false;
         Cursor.lockState  = CursorLockMode.None;
         Cursor.visible    = true;
         gunScript.enabled = false;
         EndImage.gameObject.SetActive(true);
         restart.gameObject.SetActive(true);
         GameOverText.text = "Game Over";
         scoreText.text    = "Score : " + score;
         caseImage.enabled = false;
         timerText.enabled = false;
         enemyText.enabled = false;
     }
     else if (isGameOver() && win)
     {
         fps              = GameObject.FindGameObjectWithTag("Player").GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController> ();
         fps.enabled      = false;
         Cursor.lockState = CursorLockMode.None;
         Cursor.visible   = true;
         EndImage.gameObject.SetActive(true);
         restart.gameObject.SetActive(true);
         WinText.text      = "Level Complete";
         scoreText.text    = "Score : " + score;
         caseImage.enabled = false;
         timerText.enabled = false;
         enemyText.enabled = false;
     }
 }
Exemplo n.º 8
0
    void OpenStart()
    {
        // print("Bob's your uncle");
        if (startScreen == null)
        {
            startScreen = GameObject.FindGameObjectWithTag("StartScreen");
        }
        if (canvas2 == null)
        {
            canvas2 = GameObject.FindGameObjectWithTag("Canvas2").GetComponent <Canvas>();
        }
        // canvas2.renderMode = RenderMode.WorldSpace;
        //canvas2.worldCamera = Camera.main;
        //canvas2.renderMode = RenderMode.ScreenSpaceCamera;
        startScreen.SetActive(true);
        if (!startScreenActive)
        {
            startScreenActive = true;
        }
        //fpscontroller = GameObject.FindGameObjectWithTag("Player").GetComponent<UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
        //fpscontroller.enabled = false;
        //GameObject.Find("EventSystem").GetComponent<EventSystem>().SetSelectedGameObject(GameObject.Find("ResumeGameButton"), null);


        fpscontroller         = GameObject.FindGameObjectWithTag("Player").GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
        fpscontroller.enabled = false;
        Cursor.lockState      = CursorLockMode.Confined;

        Cursor.lockState = CursorLockMode.None;
        Cursor.lockState = CursorLockMode.Confined;
        Cursor.visible   = true;


        pauseScript.MenuOn();
    }
Exemplo n.º 9
0
 private void Start()
 {
     playerAudio        = GetComponent <AudioSource>();
     playerMovement     = GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
     currentHealth      = startingHealth;
     healthSlider.value = startingHealth;
 }
Exemplo n.º 10
0
    void Bend(Vector3 dir)
    {
        Vector3 distance = bone5.transform.position - dir;
        float   strength = Mathf.Max(0, sensitivity - distance.magnitude * 5 * sensitivity);

        if (sinkScript.IsWaterRunning() && !sinkScript.IsFree())
        {
            Debug.Log(distance.magnitude);
            Quaternion inv     = Quaternion.Inverse(transform.rotation);
            Vector3    distRel = inv * distance;
            if (distRel.x > 0)
            {
                strength *= -1;
            }
            bone1.localEulerAngles = new Vector3(0, 0, strength);
            bone2.localEulerAngles = new Vector3(0, 0, strength);
            bone3.localEulerAngles = new Vector3(0, 0, strength);
            bone4.localEulerAngles = new Vector3(0, 0, strength);
            bone5.localEulerAngles = new Vector3(0, 0, strength);
        }
        else
        {
            sinkScript.CheckOpen(distance.magnitude < 0.05f);
            if (sinkScript.IsWaterRunning())
            {
                GameObject player = GameObject.FindWithTag("Player");
                UnityStandardAssets.Characters.FirstPerson.FirstPersonController fpc = player.GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
                fpc.m_WalkSpeed = oldw;
                fpc.m_RunSpeed  = oldr;
                Destroy(gameObject);
            }
        }
    }
Exemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     movementScript     = this.gameObject.GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
     soundSphere.radius = standardSize;
     camera             = GameObject.FindGameObjectWithTag(Tags.MainCamera).GetComponent <Camera>();
     fireRateTimer      = 0;
 }
Exemplo n.º 12
0
    void Start()
    {
        _cannie  = GameObject.Find("Canvas");
        _powerUp = Random.Range(0, 3);
        _body    = this.GetComponent <Rigidbody>();
        _fpc     = this.GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
        //random power up selection;
        //_powerUp = Random.Range(1,2);
        _endMesh = /*MANAGER.CityManager.Instance.endPoint*/ null;
        switch (_powerUp)
        {
        case 0:
            _cannie.transform.GetChild(1).gameObject.SetActive(true);
            _cannie.transform.GetChild(2).gameObject.SetActive(false);
            _cannie.transform.GetChild(3).gameObject.SetActive(false);
            break;

        case 1:
            _cannie.transform.GetChild(1).gameObject.SetActive(false);
            _cannie.transform.GetChild(2).gameObject.SetActive(true);
            _cannie.transform.GetChild(3).gameObject.SetActive(false);
            _ammoCount      = _cannie.transform.GetChild(2).GetChild(0).GetComponent <Text>();
            _ammoCount.text = "Ammo: " + _ammo;
            break;

        case 2:
            _cannie.transform.GetChild(1).gameObject.SetActive(false);
            _cannie.transform.GetChild(2).gameObject.SetActive(false);
            _cannie.transform.GetChild(3).gameObject.SetActive(true);
            _invisibleCanvasValue          = _cannie.transform.GetChild(3).GetChild(0).GetComponent <Slider>();
            _invisibleCanvasValue.maxValue = _invisibleTime;
            break;
        }
    }
Exemplo n.º 13
0
    // Use this for initialization
    void Start()
    {
        ponds = GameObject.FindGameObjectsWithTag("Pond");
        if (ItemInventory.hasSnorkel)
        {
            colls = gameObject.GetComponentsInChildren <Collider>();
            foreach (Collider col in colls)
            {
                col.isTrigger = true;
            }
        }
        popup = GameObject.FindGameObjectWithTag("PopupManager").GetComponent <PopupManager>();

        pondParticle = gameObject.transform.Find("PondParticle").gameObject;
        pondParticle.SetActive(false);
        teleportHasntRun = true;
        playerTransform  = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
        pondIndex        = Random.Range(0, ponds.Length);
        otherPond        = ponds[pondIndex];
        if (Vector3.Distance(otherPond.transform.position, gameObject.transform.position) < 3)
        {
            checkPonds();
        }
        fpscontroller = GameObject.FindGameObjectWithTag("Player").GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
    }
Exemplo n.º 14
0
    // Update is called once per frame
    void FixedUpdate()
    {
        //Magic
        WalkSystem();

        //Gravity and Clamp
        walkSpeed -= Time.fixedDeltaTime * gravityFactor;
        walkSpeed  = Mathf.Clamp(walkSpeed, 0, 1);

        //Time states control
        IncreaseCurrentDeltaTime();

        //Ad Current State to array
        AddToArrayStates();

        //TODO: Parche animator.
        if (anim != null)
        {
            anim.SetFloat("Speed", walkSpeed);
        }

        //TODO: PArche FPS!
        UnityStandardAssets.Characters.FirstPerson.FirstPersonController fps = GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
        if (fps != null)
        {
            fps.vertical = walkSpeed;
        }
    }
Exemplo n.º 15
0
 // Start is called before the first frame update
 void Start()
 {
     mazeMat    = new int[size, size];
     isRotate   = false;
     prevSpeed  = 0;
     controller = this.GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
 }
Exemplo n.º 16
0
    void OnTriggerEnter(Collider other)
    {
//m_Jump_Pad = true for jumppad

        GameObject go = GameObject.Find("FPSController");


        UnityStandardAssets.Characters.FirstPerson.FirstPersonController FirstPersonController = go.GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();


        StartCoroutine(Jumppad());

        IEnumerator Jumppad()
        {
            Debug.Log("Jumppad used");
            //FirstPersonController.Padforce = force_pad;

            if (GameObject.Find("Morphball") != null)
            {
                GameObject go2 = GameObject.Find("Morphball");
                morph = go2.GetComponent <Rigidbody>();
                morph.AddForce(x, y, z, ForceMode.Impulse);
            }


            //FirstPersonController.m_Jump_Pad = true;
            yield return(new WaitForSeconds(1));
            //FirstPersonController.m_Jump_Pad = false;
        }
    }
Exemplo n.º 17
0
    public void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            if (!beenAsked)
            {
                fpscontroller         = GameObject.FindGameObjectWithTag("Player").GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
                fpscontroller.enabled = false;
                //Cursor.lockState = CursorLockMode.Confined;

                //Cursor.lockState = CursorLockMode.None;
                //Cursor.lockState = CursorLockMode.Confined;
                //Cursor.visible = true;
                RedDoorPanel.SetActive(true);
                //RedDoorPanel.transform.Find("OpenIt").GetComponent<Button>().onClick.AddListener(delegate { OpenRedDoor(); });
                //RedDoorPanel.transform.Find("LeaveIt").GetComponent<Button>().onClick.AddListener(delegate { DontOpen(); });

                if (!pausescript)
                {
                    pausescript = GameObject.FindGameObjectWithTag("GamePauser").GetComponent <Pause>();
                }
                pausescript.MenuOn();

                if (LanguageChange.LangNum == 1)
                {
                    RedDoorPanel.transform.Find("Text").GetComponent <Text>().text = "红门后面什么也没有。";

                    RedDoorPanel.transform.Find("LeaveIt").GetComponentInChildren <Text>().text = "选择不打开它";
                    RedDoorPanel.transform.Find("OpenIt").GetComponentInChildren <Text>().text  = "打开红门";
                }
                GameObject.Find("EventSystem").GetComponent <EventSystem>().SetSelectedGameObject(GameObject.Find("LeaveIt"), null);
            }
        }
    }
Exemplo n.º 18
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            CharacterController controller = other.gameObject.GetComponent <CharacterController>();
            UnityStandardAssets.Characters.FirstPerson.FirstPersonController player_script = (UnityStandardAssets.Characters.FirstPerson.FirstPersonController)other.gameObject.GetComponent("FirstPersonController");
            if (controller != null)
            {
                controller.enabled = false;
            }

            other.gameObject.transform.position = teleport_to.transform.position;
            other.gameObject.transform.rotation = teleport_to.transform.rotation;


            if (controller != null)
            {
                controller.enabled = true;
            }
            if (player_script != null)
            {
                player_script.Reset();
            }
        }
    }
Exemplo n.º 19
0
 // Use this for initialization
 void Start()
 {
     canControlShip = false;
     moveSpeed      = 3f;
     controller     = GetComponent <CharacterController>();
     theBoat        = FindObjectOfType <BoatMovement>();
     fpsController  = GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
 }
Exemplo n.º 20
0
    private void Start()
    {
        inventory = Inventory.instance;
        inventory.onItemChangedCallBack += UpdateUI;
        slots = itemsPerent.GetComponentsInChildren <InventorySlot>();

        firstPersonController = player.GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
    }
Exemplo n.º 21
0
    // Use this for initialization
    protected virtual void Start()
    {
        //Damage += GameObject.Find("z@walk").GetComponent<EnemyBehaviour>().AddDamage;

        fpsController = GetComponentInParent<UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
        defaultFieldOfView = fpsController.Camera.fieldOfView;
        crosshairPosition = new Rect((Screen.width - crosshairTexture.width) / 2, (Screen.height - crosshairTexture.height) / 2, crosshairTexture.width, crosshairTexture.height);
    }
 //Called even before Start()
 void Awake()
 {
     _barHeight = Screen.height * 0.04f;
     _barWidth = _barHeight * 10.0f;
     _characterController = GetComponent<CharacterController>();
     _firstPersonController = gameObject.GetComponent<UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
     _lastPosition = transform.position;
 }
Exemplo n.º 23
0
    void Awake()
    {
        barHeight = Screen.height * 0.02f;
        barWidth = barHeight * 10.0f;

        characterController = GetComponent<CharacterController>();
        fpsController = GetComponent<UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
    }
Exemplo n.º 24
0
    // Use this for initialization
    public void setUpReferences()
    {
        m_FirstPersonController = GetComponentInParent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();

        constructSphere();

        m_MeleeAudio = GetComponent <AudioSource> ();
        m_PlayerMeleeOnTriggerEnter = m_Sphere.GetComponentInChildren <PlayerMeleeOnTriggerEnter> ();
    }
Exemplo n.º 25
0
    // Start is called before the first frame update
    void Start()
    {
        itemPanel.SetActive(false);
        fpController         = player.GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
        fpController.enabled = true;

        listOfItems.Add(item[0]);
        listOfItems.Add(item[1]);
    }
Exemplo n.º 26
0
 private void OnTriggerEnter(Collider other)
 {
     //Debug.Log("Entered" + other.gameObject.layer);
     if (other.gameObject.layer == 10)
     {
         controller = other.gameObject.GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
         Invoke("Play", delay);
     }
 }
Exemplo n.º 27
0
    // Use this for initialization
    void Start()
    {
        normalColor     = new Color(0.89f, 0.93f, 1f, 0.5f);
        underwaterColor = new Color(0, 0.4f, 0.7f, 0.6f);

        rb  = GetComponent <Rigidbody>();
        cf  = GetComponent <ConstantForce>();
        fpc = GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
    }
Exemplo n.º 28
0
 public void Interact(GameObject item, GameObject Player)
 {
     GenericResponse();
     if (item == null)
     {
         if (fpsController == null)
         {
             fpsController = Player.GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
         }
         fpsController.enabled = false;
         Cursor.visible        = true;
         Cursor.lockState      = CursorLockMode.None;
         if (liveQuest[0])
         {
             CompleteQuest();
         }
         Cursor.visible = true;
         ran1           = Random.Range(0, options1s.Length);
         ran2           = Random.Range(0, options2s.Length);
         ran3           = Random.Range(0, options3s.Length);
         options1.GetComponentInChildren <Text>().text = options1s[ran1];
         options2.GetComponentInChildren <Text>().text = options2s[ran2];
         options3.GetComponentInChildren <Text>().text = options3s[ran3];
         options1.gameObject.SetActive(true);
         options2.gameObject.SetActive(true);
         options3.gameObject.SetActive(true);
     }
     else if (item.GetComponent <ItemScript>().Food == "Banana")
     {
         AddLove(2);
         if (liveQuest[1])
         {
             CompleteQuest();
         }
     }
     else if (item.GetComponent <ItemScript>().Food == "Coconut")
     {
         AddLove(4);
         if (liveQuest[2])
         {
             CompleteQuest();
         }
     }
     else if (item.GetComponent <ItemScript>().Food == "Fish")
     {
         AddLove(8);
         if (liveQuest[3])
         {
             CompleteQuest();
         }
     }
     else
     {
         GenericResponse();
     }
 }
Exemplo n.º 29
0
 // Start is called before the first frame update
 void Start()
 {
     canvasAnim = GetComponent <Animator>();
     LevelTransition.OnLevelEnd += LevelTransition_OnLevelEnd;
     player                       = FindObjectOfType <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
     player.OnSprint             += Player_OnSprint;
     InteractiveObject.OnUseText += InteractiveObject_OnUseText;
     Weapon.OnWeaponSwitch       += Weapon_OnWeaponSwitch;
     canvasAnim.SetTrigger("Start");
 }
Exemplo n.º 30
0
 public void StartMaze()
 {
     uiManager.PregameUIOff();
     startingCamera.gameObject.SetActive(false);
     uiManager.ControlsUIOff();
     playerInstance = Instantiate(playerPrefab) as UnityStandardAssets.Characters.FirstPerson.FirstPersonController;
     uiManager.GameUIOn();
     timer.StartTime();
     gameActive = true;
 }
Exemplo n.º 31
0
    void Awake()
    {
        barHeight = Screen.height * 0.02f;
        barWidth  = barHeight * 10.0f;

        chCont = GetComponent <CharacterController>();
        fpsC   = gameObject.GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();

        lastPosition = transform.position;
    }
Exemplo n.º 32
0
    // Use this for initialization
    void Start()
    {
        for (int i = 0; i < transform.childCount; i++)
        {
            books.Add(transform.GetChild(i).gameObject);
            //Debug.Log(books[i]);
        }

        fc = GameObject.Find("FPSController").GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
    }
Exemplo n.º 33
0
    private bool m_Damaged;                                                                    // True when the player gets m_Damaged.

    void Awake()
    {
        // Setting up the references.
//      anim = GetComponent <Animator> ();
        m_PlayerAudio    = GetComponent <AudioSource> ();
        m_PlayerMovement = GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController> ();

        // Set the initial health of the player.
        m_CurrentHealth = m_StartingHealth;
    }
Exemplo n.º 34
0
    void Awake()
    {
        if (Instance == null)
        {
            DontDestroyOnLoad(gameObject);
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }
        fps = GameObject.FindObjectOfType<FirstPersonController>();
        fpsTransform = GameObject.Find("FPSController").transform;


       
    }
Exemplo n.º 35
0
    /// <param name="manager">The NetworkManager</param>
    /// <param name="lobbyPlayer">the lobbyPlayer that gives out values to NetworkCharacterInfo</param>
    /// <param name="gameplayer">Makes Ourplayer the same as the selected gamePlayer</param>
    public override void OnLobbyServerSceneLoadedForPlayer(NetworkManager manager, GameObject lobbyPlayer, GameObject gamePlayer)
    {
        LobbyPlayer lobby = lobbyPlayer.GetComponent<LobbyPlayer>();
        if (gamePlayer.GetComponent<NetworkCharacterInfo>())
        {
            OurPlayer = gamePlayer;
            MouseLocking = OurPlayer.GetComponent<UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
            NetworkCharacterInfo characterInfo = gamePlayer.GetComponent<NetworkCharacterInfo>();
            

            characterInfo.playerName = lobby.name;
            characterInfo.name = characterInfo.playerName;
            characterInfo.checkingTexture = lobby.playersTexture;
            characterInfo.color = lobby.playerColor;
            characterInfo.teamNumber = (lobby.setTeamNumber + 1);
            characterInfo.gameObject.GetComponent<NetworkCharacterInfo>().teamNumber = (lobby.setTeamNumber + 1);
            isinLevel = true;
        }
    }
Exemplo n.º 36
0
 // Use this for initialization
 void Start()
 {
     _char = GetComponent<CharacterController>();
     _controller = GetComponent<UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
 }
Exemplo n.º 37
0
 void Awake()
 {
     fpsController = (FirstPersonController)gameObject.GetComponent(typeof(FirstPersonController));
     menuState = MenuStates.Game;
 }
Exemplo n.º 38
0
 void Awake()
 {
     playerAudio = GetComponent<AudioSource>();
     firstPersonController = GetComponent<UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
     currentHealth = startingHealt;
 }
Exemplo n.º 39
0
 private void Awake()
 {
     Functions.Initialize();
     firstPersonCamera = IsDoom ? GameObject.Find("Fisheye view camera").GetComponent<Camera>() : this.GetComponent<Camera>();
     //ICCameras = GameObject.Find("Imersive");
     firstPersonCamera.enabled = true;
     mainCamera = GameObject.Find("Main Camera").GetComponent<Camera>();
     textures = new List<Texture2D>();
     string path = "Textures";
     var files = Directory.GetFiles(path);
     foreach (var f in files) {
         textures.Add(LoadTexture(f));
     }
     int.TryParse(extensionStartStr, out extensionStart);
     int.TryParse(extensionThresholdStr, out extensionThreshold);
     var material = baseGround.GetComponent<MeshRenderer>().sharedMaterial;
     material.mainTexture = null;
     controller = this.GetComponentInParent<FirstPersonController>();
     PolygonManager = GameObject.FindObjectOfType<PolygonManager>();
     PlayerState = GameObject.Find("PlayerState").GetComponent<TextMesh>();
     FishEyeCamera = GameObject.Find("Fisheye view camera");
     cameraPos = FishEyeCamera.transform.position;
     audioSource = this.GetComponentInParent<AudioSource>();
 }
Exemplo n.º 40
0
		void Start(){
			manager = GetComponent<AbilityManager>();
			controller = GetComponent<FirstPersonController>();
            player = Player.Instance;
		}
Exemplo n.º 41
0
    void Start()
    {
        fxAudioSource = GetComponent<AudioSource>();

        if(gameObject.CompareTag("Player")){
            DontDestroyOnLoad(gameObject);

            playerCont = GetComponent<UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
            charControl = GetComponent<CharacterController>();
            UpdateJumpSpeed();

            if(fist == null)
                fist = GetComponentInChildren<Weapon>().gameObject;
            weapons.Add(fist);
            activeWeapon = fist;
            InventoryManager.InspectionHolder = inspectionHolder;
        }

        GetCharAnimator();

        if(charAnimator != null)
            charAnimator.runtimeAnimatorController = NPCManager.Instance.basicController;

        InitBC(GameManager.CurrentScene);
    }
Exemplo n.º 42
0
    public void Climb(bool climb)
    {
        _isClimbing = climb;

        if(playerCont == null)
            playerCont = GetComponent<UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();

        if(playerCont != null)
            playerCont.Climb(_isClimbing);
    }
 // Use this for initialization
 private void Start()
 {
     timeAlive = Time.time;
     text = GameObject.FindGameObjectWithTag ("Score").GetComponent<Text> () as Text;
     player = GameObject.FindGameObjectWithTag ("Player").GetComponent<FirstPersonController> ();
 }
Exemplo n.º 44
0
    void Start()
    {

        int x = 0;
        for (int i = 0; i < numberOfEnemyObjects; i++)
        {

            Vector3 pos = new Vector3(transform.position.x-25 + x, transform.position.y-5, transform.position.z +1);
            GameObject c = (GameObject) Instantiate(enemyPrefab,pos,Quaternion.identity);
            //c.transform.parent = transform;
           // c.transform.position = pos;
            x = x + 2;
        }
        int y = 1;
        for (int j = 0; j < numberOfPlayerObjects; j++)
        {

            Vector3 pos = new Vector3(transform.position.x-25 + y, transform.position.y-5, transform.position.z+1);
            GameObject c = (GameObject) Instantiate(playerPrefab, pos, Quaternion.identity);
            //c.transform.parent = transform;
            //c.transform.position=new Vector3(0 + x, 0, 1);
            y = y + 2;
        }

        playerCubes = GameObject.FindGameObjectsWithTag("playerCubes");
        enemyCubes = GameObject.FindGameObjectsWithTag("enemyCubes");
        controller = GameObject.FindObjectOfType<FirstPersonController>();
        var test = GameObject.Find("Enemy");
        var test1 = GameObject.Find("Enemy2");
        enemy1 = test.GetComponent<EnemyAI>();
        enemy2 = test1.GetComponent<EnemyAI>();
        //enemy1 = GameObject.FindObjectOfType<EnemyAI> ();
        var sound =	enemy1.GetComponent<AudioClip>();

        //Debug.Log("SOUND:" + sound);

        for (int i = 0; i < 1023; i++)
        {


            int test12434 = Random.Range(1, 100);
            float num = (float)test12434 / 100;
           // Debug.Log(num);
            spectest[i, 0] = num; 
        }

       // Debug.Log("test" + spectest[555, 0]);

        for (int i = 0; i < enemyCubes.Length; i++)
        {
            Vector3 prev = enemyCubes[i].transform.localScale;

            prev.y = 0.0f;
            enemyCubes[i].transform.localScale = prev; 
        }
        for (int i = 0; i < playerCubes.Length; i++)
        {
            Vector3 prev = playerCubes[i].transform.localScale;

            prev.y = 0.0f;
            playerCubes[i].transform.localScale = prev; 
        }
    }
Exemplo n.º 45
0
 // Use this for initialization
 private void Start()
 {
     m_CharacterController = GetComponent<CharacterController>();
     m_Camera = Camera.main;
     m_OriginalCameraPosition = m_Camera.transform.localPosition;
     m_FovKick.Setup(m_Camera);
     m_HeadBob.Setup(m_Camera, m_StepInterval);
     m_StepCycle = 0f;
     m_NextStep = m_StepCycle/2f;
     m_Jumping = false;
     m_AudioSource = GetComponent<AudioSource>();
     m_MouseLook.Init(transform , m_Camera.transform);
     Instance = this;
 }
Exemplo n.º 46
0
 // Use this for initialization
 void Start()
 {
     fps = GetComponent<UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
     locks = new List<Object>();
     motor = GetComponent("CharacterMotor") as MonoBehaviour;
 }