Inheritance: MonoBehaviour
示例#1
0
 void Start() {
     sliders = GameObject.Find("Canvas").GetComponent<PlayerUI>();
     if (isLocalPlayer) {
         Cmdrandom_color();
     }
     head_rot = Quaternion.identity;
 }
示例#2
0
 public void SetColors(PlayerUI colorSource)
 {
     cylinder.renderer.material.color = colorSource.BrightPlayerColor;
     frame.renderer.material.color = colorSource.DarkPlayerColor;
     liveBulletColor = colorSource.LiveBulletColor;
     deadBulletColor = colorSource.DeadBulletColor;
 }
	void Start ()
	{
		_rb = GetComponent<Rigidbody> ();
		_animator = GetComponent<Animator> ();
		_sr = GetComponent<SpriteRenderer> ();
		_playerHeight = GetComponent<BoxCollider> ().size.y * transform.localScale.y;
		_playerWidth = GetComponent<BoxCollider> ().size.x * transform.localScale.x;
		_playerUI = GetComponent<PlayerUI>();
	}
示例#4
0
 // Use this for initialization
 void Start()
 {
     adminUI = transform.Find("admin").GetComponent<AdminUI>();
     mainUI = transform.Find("menu").GetComponent<MainUI>();
     accountUI = transform.Find("account").GetComponent<AccountUI>();
     loginUI = transform.Find("login").GetComponent<LoginUI>();
     passwordUI = transform.Find("password").GetComponent<PasswordUI>();
     charactersUI = transform.Find("characters").GetComponent<CharactersUI>();
     characterUI = transform.Find("character").GetComponent<CharacterUI>();
     playerUI = transform.Find("player").GetComponent<PlayerUI>();
 }
示例#5
0
 public void SetColors(PlayerUI colorSource)
 {
     frame.renderer.material.color = colorSource.DarkPlayerColor;
     slideBack.renderer.material.color = colorSource.BrightPlayerColor;
     slideForward.renderer.material.color = colorSource.BrightPlayerColor;
     liveBulletColor = colorSource.LiveBulletColor;
     deadBulletColor = colorSource.DeadBulletColor;
     for(int i = 0; i < shells.Length; i++){
         shells[i].renderer.material.color = colorSource.LiveBulletColor;
     }
     partialLoadShell.renderer.material.color = colorSource.LiveBulletColor;
 }
示例#6
0
 public void SetColors(PlayerUI colorSource)
 {
     boltClosed.renderer.material.color = colorSource.BrightPlayerColor;
     boltUp.renderer.material.color = colorSource.BrightPlayerColor;
     boltOpen.renderer.material.color = colorSource.BrightPlayerColor;
     frame.renderer.material.color = colorSource.DarkPlayerColor;
     partialLoadBullet.renderer.material.color = colorSource.LiveBulletColor;
     liveBulletColor = colorSource.LiveBulletColor;
     deadBulletColor = colorSource.DeadBulletColor;
     for(int i = 0; i < bullets.Length; i++){
         bullets[i].renderer.material.color = colorSource.LiveBulletColor;
     }
 }
示例#7
0
    void Start()
    {
        for (int i = 0; i < InitialNeutralCells; i++)
        {
            SpawnNeutral();
        }

        playerScript = GameObject.Find("Player").GetComponent <PlayerScript>();

        ui          = GameObject.Find("PlayerUI").GetComponent <PlayerUI>();
        countdownUI = GameObject.Find("countdownCanvas").GetComponent <CountDown>();

        cameraScript = GameObject.Find("Main Camera").GetComponent <CameraFollow>();

        SpawnUrgency = 5.0f;

        syringe = GameObject.Find("syringe");

        ui.gameObject.SetActive(false);

        preGameCounter = 4.0f;

        difficulty = DifficultySelection.EASY;

        if (GameObject.Find("PersistentObject(Clone)"))
        {
            difficulty = GameObject.Find("PersistentObject(Clone)").GetComponent <PersistentData>().difficulty;
            Destroy(GameObject.Find("PersistentObject(Clone)"));
        }

        if (difficulty == DifficultySelection.EASY)
        {
            levelTimer = 240.0f;
        }
        else if (difficulty == DifficultySelection.MEDIUM)
        {
            levelTimer = 180.0f;
        }
        else
        {
            levelTimer = 120.0f;
        }

        audioSource = transform.GetComponent <AudioSource>();

        audioSource.clip = regularBGM;
        audioSource.Play();
    }
        public static IEnumerator Notify(string message, Color color, float displayTime)
        {
            var started = Time.realtimeSinceStartup;

            while (true)
            {
                yield return(new WaitForEndOfFrame());

                PlayerUI.hint(null, EPlayerMessage.INTERACT, message, color);

                if (Time.realtimeSinceStartup - started > displayTime)
                {
                    yield break;
                }
            }
        }
示例#9
0
        public void CreatePlayer(PlayerUI playerUI)
        {
            PlayerController playerController = new PlayerController();
            PlayerData       playerData       = new PlayerData(100, 20);

            playerController.SetPortalsController(portalRandomizer);
            playerController.SetPlayerDataOutput(playerUI);
            playerController.SetPlayerDeadOutput(playerUI);
            playerController.SetPlayerTeleportableOutput(playerUI);
            playerController.SetImpactService(impactService);
            playerUI.SetPlayerTeleportationNotifier(playerController);
            playerUI.SetPlayerCollisionNotifier(playerController);
            playerUI.SetPlayerData(playerData);
            playerUI.SetPortalUIIdentifier(portalUIIdentifier);
            playerUI.SetPortalRemover(portalRemover);
        }
示例#10
0
 public void RemoveEnemyFromList(Enemy script)
 {
     enemiesList.Remove(script);
     if (enemiesList.Count <= 0)
     {
         gameIsOver = true;
         gameIsWon  = true;
         if (level == 5)
         {
             Invoke("Redo", exitLevelDelay);
             return;
         }
         PlayerUI ui = GameObject.FindWithTag("UIManager").GetComponent <PlayerUI>();
         ui.SetExitButton(true);
     }
 }
示例#11
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        foreach (GameObject bar in hpBars)
        {
            bar.GetComponent <Animator>().enabled = false;
        }
    }
示例#12
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        else if (instance != this)
        {
            Destroy(gameObject);
        }

        fireAttack = FindObjectOfType <FireAttack>();
        player     = FindObjectOfType <Player>();
        playerUI   = FindObjectOfType <PlayerUI>();
    }
示例#13
0
    // Update is called once per frame
    void Update()
    {
        // If the game is not currently running, stop
        if (!CurrentState.Equals(GameState.GAME_RUNNING))
        {
            return;
        }

        // Game timer
        UITimerCounter += Time.deltaTime;
        if (UITimerCounter >= UITimerCounterEnd)
        {
            UITimerCounter = 0.0f;
            PlayerUI.UpdateTimer();
        }
    }
示例#14
0
    private void Start()
    {
        //defaultArmAimPos = armsAnim.transform.localPosition;
        //defaultArmAimRot = armsAnim.transform.localEulerAngles;
        defaultArmAimHeight = armsAnim.transform.localPosition.y;
        Cursor.lockState    = CursorLockMode.Locked;
        defaultFOV          = cam.fieldOfView;
        standHeight         = cc.height;

        SetPosition(GameManager.Instance.playerSpawn.position);
        MovementSpeed = runSpeed;

        AddWeapon(starterWeapon);
        PickUpAmmo(starterWeapon.ammoType, 50); //Test start ammo
        PlayerUI.SetAmmoText(activeWeapon);
    }
示例#15
0
    void Start()
    {
        state = prevState = GamePad.GetState(playerIndex);
        rb    = GetComponent <Rigidbody>();
        col   = rb.GetComponent <Collider>();

        playerUI = Instantiate(followUIPrefab).GetComponent <PlayerUI>();
        playerUI.Init(transform);
        playerUI.SetAmmo(ammo);

        maxAmmo   = ammo;
        maxHealth = health;

        transform.rotation = Quaternion.LookRotation(-transform.position + Vector3.up * transform.position.y); // Point to centre, IGNORE Y
        currentLook        = -transform.position.normalized;
    }
    public void InputDefend()
    {
        PlayerStateMachine playerManage = CharsToManage[0].GetComponent <PlayerStateMachine>();

        PlayerChoice.attacker  = CharsToManage[0].name;
        PlayerChoice.type      = "Player";
        PlayerChoice.AttakerGO = CharsToManage[0];

        playerManage.animState = -2;

        playerManage.player.currDEF += 5;
        playerManage.player.currRES += 5;
        attributeTime          = true;
        playerManage.defending = 0;
        playerInput            = PlayerUI.DONE;
    }
示例#17
0
        public SceneGame(Game game, SaveFile saveFile) : base(game)
        {
            SaveFile = saveFile;

            ActionQueue = new ActionQueue(this);
            Menu        = new PlayerUI(this);

            Load();

            Player = Entities.First(x => x is Hero);

            CameraMap   = Player.Map;
            CameraFocus = new CameraFocus(Player);

            Spawner = new EnemySpawner(this, 5);
        }
    void Start()
    {
        playerBehavior = FindObjectOfType <PlayerBehavior>();
        NarrativeEvent[] acts = GetComponents <NarrativeEvent>();
        UI = GameObject.FindGameObjectWithTag("UI").GetComponent <PlayerUI>();

        actions = new List <NarrativeEvent> ();

        foreach (NarrativeEvent a in acts)
        {
            if (a.enabled)
            {
                actions.Add(a);
            }
        }
    }
示例#19
0
 //본인의 UI를 찾아서 셋팅할 함수
 void PlayerUISetting()
 {
     if (FindObjectOfType <PlayerUI>())
     {
         PlayerUI p_UI = FindObjectOfType <PlayerUI>();
         //UI의 체력 설정
         p_UI.player      = this;
         p_UI.hp.maxValue = currHP;
         p_UI.hp.value    = currHP;
         //UI의 마나 설정
         p_UI.mp.maxValue = currMP;
         p_UI.mp.value    = currMP;
         //UI의 스킬 아이콘 설정
         p_UI.skill_Icon.sprite = PlayerData.skill_Icon;
     }
 }
示例#20
0
    //Camera sceneCamera;

    void Start()
    {
        //If we don't control the player, disable these components
        if (!isLocalPlayer)
        {
            DisableComponenets();
            AssignRemoteLayer();
        }
        else
        {
            //Commented to add death cam
            // sceneCamera = Camera.main;
            // if (sceneCamera != null)
            // {
            //     sceneCamera.gameObject.SetActive(false);
            // }

            // Disable Local Player Graphics
            SetLayerRecursively(playerGraphics, LayerMask.NameToLayer(dontDrawLayerName));

            // Create Player UI
            playerUIInstance      = Instantiate(playerUIPrefab);
            playerUIInstance.name = playerUIPrefab.name;

            //Configure PlayerUI
            PlayerUI ui = playerUIInstance.GetComponent <PlayerUI> ();
            if (ui == null)
            {
                Debug.LogError("No PlayerUI component on PlayerUI prefab.");
            }
            ui.SetPlayer(GetComponent <Player>());

            GetComponent <Player>().SetupPlayer();

            string _username = "******";
            if (UserAccountManager.IsLoggedIn)
            {
                _username = UserAccountManager.LoggedIn_Username;
            }
            else
            {
                _username = transform.name;
            }

            CmdSetUserName(transform.name, _username);
        }
    }
示例#21
0
 void Start()
 {
     instance = this;
     SettingComponent();
     //플레이어번호와 캐릭터 번호,이름을 넘긴다
     if (photonview.isMine)
     {
         int    num          = LobbyPlayerlist.Instance.current_player_number;
         int    chracter_num = LobbyPlayerlist.Instance.current_chracter_number;
         string playername   = PhotonNetwork.player.NickName;
         photonview.RPC("SetPlayerUI", PhotonTargets.All, num, chracter_num, playername);
         hpnumber  = Player.instance.playerdata.hp;
         hp.sprite = hplist[hpnumber - 1];
         mpnumber  = Player.instance.playerdata.mp;
         mp.sprite = mplist[mpnumber - 1];
     }
 }
示例#22
0
    public PlayerController(PlayerUI ui, Vector2 startLocation, Material mat, Vector2 m_limit, Color color, AudioClip m_dropSound)
    {
        player_selector = new Pipe(new Vector3(Utilities.tileSize, Utilities.tileSize, Utilities.thickness), TILE_TYPE.CLEAR, mat);

        playerUI = ui;
        for (int i = 0; i < nextDropType.Length; i++)
        {
            nextDropType [i] = Utilities.getRandomDropTile();
        }
        location  = startLocation;
        limit     = m_limit;
        dropSound = m_dropSound;
        player_selector.setLocation(Utilities.getLocationVector(startLocation, Utilities.PLAYER_LAYER));
        playerUI.UpdateNextDrops(nextDropType);
        player_selector.setTileType(nextDropType [0]);
        player_selector.setColor(color);
    }
示例#23
0
    void Start()
    {
        health            = maxhealth;
        disable           = this.GetComponent <LookAround>();
        death             = this.GetComponent <AudioSource>();
        playingdeath      = false;
        alive             = true;
        ui                = this.GetComponent <PlayerUI>();
        jcount            = maxjumps;
        rb                = GetComponent <Rigidbody>();
        rb.freezeRotation = true;
        sc                = GameObject.FindGameObjectWithTag("SC").GetComponent <SceneController>();
        ui.SetMaxHealth(maxhealth);


        // playerGravity = rb.gravity;
    }
示例#24
0
    private void Start()
    {
        cam.worldCamera = Camera.main;

        PUi = GetComponent <PlayerUI>();



        if (HumanControl)
        {
            charIndex = PlayerPrefs.GetInt("char");

            changeCharacter(charIndex);
            money        = PlayerPrefs.GetInt("money");
            v_Money.text = PlayerPrefs.GetInt("money") + "";
        }
    }
示例#25
0
    // Use this for initialization
    void Start()
    {
        Utilities.p1_selector_mat     = p1_selector_mat;
        Utilities.p1_light_mat        = p1_light_mat;
        Utilities.p2_selector_mat     = p2_selector_mat;
        Utilities.p2_light_mat        = p2_light_mat;
        Utilities.arrow_mat           = arrow_mat;
        Utilities.angle_arrow_mat     = angle_arrow_mat;
        Utilities.opp_angle_arrow_mat = opp_angle_arrow_mat;
        MakeWalls();
        Vector2 limit = new Vector2(rows, columns);

        p1UI         = new PlayerUI(new Vector2(-Utilities.tileSize * 2, 0), Utilities.NEXT_TILES, p1_light_mat, p1_selector_mat);
        p2UI         = new PlayerUI(new Vector2(Utilities.tileSize * (columns + 1), Utilities.tileSize * (rows - 3)), Utilities.NEXT_TILES, p2_light_mat, p2_selector_mat);
        p1controller = new PlayerController(p1UI, p1_location, p1_selector_mat, limit);
        p2controller = new PlayerController(p2UI, p2_location, p2_selector_mat, limit);
    }
示例#26
0
        public static void DisableAllVisuals()
        {
            SpyManager.InvokePre();
            if (DrawUtilities.ShouldRun())
            {
                if (OptimizationVariables.MainPlayer.equipment.asset is ItemGunAsset pAsset)
                {
                    UseableGun PGun = OptimizationVariables.MainPlayer.equipment.useable as UseableGun;

                    PlayerUI.updateCrosshair(PGun.isAiming
                                                ? WeaponComponent.AssetBackups[pAsset.id][5]
                                                : WeaponComponent.AssetBackups[pAsset.id][6]);
                }
            }

            SpyManager.DestroyComponents();
        }
示例#27
0
            private Tuple <int, int> choice;     // 选中的状态与卡牌ID

            protected void HandleInput()
            {
                // 点击人物则进入移动状态
                if (self.GetPlayer().allowMove)
                {
                    Transform player   = self.GetSelectedObject(Settings.playerMask);
                    PlayerUI  playerUI = self.currentPlayer.GetComponent <PlayerUI>();
                    playerUI.outlineType = self.IsCurrentPlayer(player) ? 1 : 0;
                    if (self.IsCurrentPlayer(player))
                    {
                        if (Input.GetMouseButtonDown(0))
                        {
                            fsm.TransitionTo <MovingState>();
                        }
                    }
                }
            }
示例#28
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
     lauchLevelText.gameObject.SetActive(false);
     GameManager.instance.postProcess = postProcess;
     FondLauchLevel.gameObject.SetActive(true);
     lauchLevelText.gameObject.SetActive(true);
     lauchLevelText.gameObject.GetComponent <Animator>().SetInteger("LevelStartTextInt", 0);
     _30sec.gameObject.SetActive(false);
 }
示例#29
0
    //Grabbing scripts we need from player
    void Awake()
    {
        myStats      = GetComponent <PlayerStats>();
        myUI         = GetComponentInChildren <PlayerUI>();
        myMove       = GetComponent <PlayerMovement>();
        weaponSprite = GetComponentInChildren <WeaponSpriteController>();
        grapple      = GetComponentInChildren <Grapple>();
        grapple.transform.localPosition = new Vector2();
        grapple.gameObject.SetActive(false);

        menu = GameObject.Find("MenuCanvas").GetComponent <MenuController>();

        //Test for adding a weapon to player
        loadWeapons();
        assignWeapon(0);
        assignWeapon(1);
    }
示例#30
0
    PlayerController AddPlayer(int playerNum)
    {
        switch (playerNum)
        {
        case 1:
            if (!playerAdded1)
            {
                playerAdded1 = true;
                p1UI         = new PlayerUI(new Vector2(-Utilities.tileSize * 2, 0), Utilities.NEXT_TILES, p1_light_mat, p1_ui_overlay_mat);
                p1controller = new PlayerController(p1UI, p1_location, p1_selector_mat, limit, Color.red, dropSound[0]);
                return(p1controller);
            }
            break;

        case 2:
            if (!playerAdded2)
            {
                playerAdded2 = true;
                p2UI         = new PlayerUI(new Vector2(Utilities.tileSize * (columns + 1), Utilities.tileSize * (rows - 3)), Utilities.NEXT_TILES, p2_light_mat, p2_ui_overlay_mat);
                p2controller = new PlayerController(p2UI, p2_location, p2_selector_mat, limit, Color.blue, dropSound [1]);
                return(p2controller);
            }
            break;

        case 3:
            if (!playerAdded3)
            {
                playerAdded3 = true;
                p3UI         = new PlayerUI(new Vector2(Utilities.tileSize * (columns + 1), 0), Utilities.NEXT_TILES, p3_light_mat, p3_ui_overlay_mat);
                p3controller = new PlayerController(p3UI, p3_location, p3_selector_mat, limit, Color.green, dropSound [2]);
                return(p3controller);
            }
            break;

        case 4:
            if (!playerAdded4)
            {
                playerAdded4 = true;
                p4UI         = new PlayerUI(new Vector2(-Utilities.tileSize * 2, Utilities.tileSize * (rows - 3)), Utilities.NEXT_TILES, p4_light_mat, p4_ui_overlay_mat);
                p4controller = new PlayerController(p4UI, p4_location, p4_selector_mat, limit, Color.magenta, dropSound [3]);
                return(p4controller);
            }
            break;
        }
        return(null);
    }
示例#31
0
        /*
         * Checks is we are the local player
         * if we are not the local player we diable components
         * components: controller, motor, camera and audiolistener
         * Obviously the player is always local to themselves, so this is to avoid a player
         * from controlling multiple players with ASWD or mouse
         *
         * if we are the local player, we set the scene camera to inactive.
         * because we only want to deactive the scene camera for the local player once.
         *
         * Calls Setup on Player script.
         */
        private void Start()
        {
            var player      = GetComponent <Player>();
            var playerNetId = player.PlayerName + "-" + GetComponent <NetworkBehaviour>().netId.ToString();

            Debug.Log("Player name : " + player.PlayerName);
            Debug.Log("PlayerSetup: Start(): Player: " + this.name + " NetId: " + playerNetId);
            GameManager.RegisterPlayer(playerNetId, player);

            if (!isLocalPlayer)
            {
                Debug.Log("NOT LOCAL PLAYER");
                DisableComponents();
                AssignRemoteLayer();
            }
            else
            {
                Debug.Log("IS LOCAL PLAYER");
                GameManager.SetLocalPlayerReference(player);
                //Disable model of player in PoV camera. only done once
                SetLayerRecursively(_graphics, LayerMask.NameToLayer(DontDrawLayer));
                SetLayerRecursively(_namePlatesAndSpeedBarCanvas, LayerMask.NameToLayer(DontDrawLayer));
                //create player UI, like crosshair for example.
                _playerUiInstance      = Instantiate(_playerUiPrefab);
                _playerUiInstance.name = transform.name + "GUI";
                //Link the ui to the player
                PlayerUI ui = _playerUiInstance.GetComponent <PlayerUI>();
                ui.SetPlayer(GetComponent <Player>());
                GetComponent <PlayerGUI>().HitMarker = _playerUiInstance.GetComponent <Images>().HitMarker;
            }

            if (GetComponent <NetworkIdentity>().isServer)
            {
                Debug.Log("PlayerSetup: Start(): Player is HOST.");
            }
            else
            {
                Debug.Log("PlayerSetup: Start(): Player is CLIENT.");
            }


            _head.transform.name = player.name;

            GetComponent <Player>().SetupPlayer();
        }
示例#32
0
 // Token: 0x06003983 RID: 14723 RVA: 0x001ABA5C File Offset: 0x001A9E5C
 public override void equip()
 {
     if (base.channel.isOwner || Provider.isServer)
     {
         if (base.player.equipment.state.Length < 2)
         {
             base.player.equipment.state = ((ItemFuelAsset)base.player.equipment.asset).getState(EItemOrigin.ADMIN);
             base.player.equipment.updateState();
         }
         this.fuel = BitConverter.ToUInt16(base.player.equipment.state, 0);
     }
     base.player.animator.play("Equip", true);
     this.useTime = base.player.animator.getAnimationLength("Use");
     if (base.channel.isOwner)
     {
         PlayerUI.message(EPlayerMessage.FUEL, ((int)((float)this.fuel / (float)((ItemFuelAsset)base.player.equipment.asset).fuel * 100f)).ToString());
     }
 }
示例#33
0
    private void ShowJijiaUI()
    {
        _playerUI = GlobalTools.FindObjByName(GlobalTag.PLAYERUI).GetComponent <PlayerUI>();
        _playerUI.Txt_ganraodan.gameObject.SetActive(true);
        _playerUI.Txt_ganraodan.text = GanraodanNums.ToString();

        _playerUI.Txt_jipao.gameObject.SetActive(true);
        _playerUI.Txt_jipao.text = JipaoNums.ToString();

        _playerUI.Txt_daodan.gameObject.SetActive(true);
        _playerUI.Txt_daodan.text = daodanNums.ToString();


        GlobalTools.FindObjByName(GlobalTag.PLAYERUI).GetComponent <UI_lantiao>().HideSelf();
        //GlobalTools.FindObjByName(GlobalTag.PLAYERUI).GetComponent<UI_Nengliangtiao>().ShowSelf();
        _nengliangtiao = GlobalTools.FindObjByName(GlobalTag.PLAYERUI).GetComponent <UI_Nengliangtiao>();
        _nengliangtiao.ShowSelf();
    }
示例#34
0
    public static IEnumerator ScreenShotMessageCoroutine()
    {
        float started = Time.realtimeSinceStartup;
        bool  flag2;

        do
        {
            yield return(new WaitForEndOfFrame());

            bool flag = !PlayerCoroutines.IsSpying;
            if (flag)
            {
                PlayerUI.hint(null, EPlayerMessage.INTERACT, "Тебя проверяют на /spy", Color.red, new object[0]);
            }
            flag2 = (Time.realtimeSinceStartup - started > 3f);
        }while (!flag2);
        yield break;
    }
示例#35
0
    public void joinGameButton()
    {
        if (SoldierNameInput.text.Length < 4)
        {
            return;
        }

        connectingToSrv = true;

        Destroy(GetComponent <SoundsManager>());
        joinGameGO.SetActive(true);
        StartCoroutine(PlayerUI.fadeInCanvasGroup(joinGameGO.GetComponent <CanvasGroup>()));

        PlayerPrefs.SetString("playerNick", SoldierNameInput.text);
        TestScript.initalized    = true;
        PhotonNetwork.playerName = SoldierNameInput.text;
        Connect();
    }
示例#36
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            togglePauseMenu();
        }

        if (player != null)
        {
            if (player.GetComponent <PlayerActions>().isLocalPlayer)
            {
                if (localPlayerUI == null)
                {
                    localPlayerUI = this;
                }
            }
        }
    }
示例#37
0
    void Start()
    {
        for (int i = 0; i < InitialNeutralCells; i++)
        {
            SpawnNeutral();
        }

        playerScript = GameObject.Find("Player").GetComponent<PlayerScript>();

        ui = GameObject.Find("PlayerUI").GetComponent<PlayerUI>();
        countdownUI = GameObject.Find("countdownCanvas").GetComponent<CountDown>();

        cameraScript = GameObject.Find("Main Camera").GetComponent<CameraFollow>();

        SpawnUrgency = 5.0f;

        syringe = GameObject.Find("syringe");

        ui.gameObject.SetActive(false);

        preGameCounter = 4.0f;

        difficulty = DifficultySelection.EASY;

        if (GameObject.Find("PersistentObject(Clone)"))
        {
            difficulty = GameObject.Find("PersistentObject(Clone)").GetComponent<PersistentData>().difficulty;
            Destroy(GameObject.Find("PersistentObject(Clone)"));
        }

        if (difficulty == DifficultySelection.EASY)
        {
            levelTimer = 240.0f;
        }
        else if (difficulty == DifficultySelection.MEDIUM)
        {
            levelTimer = 180.0f;
        }
        else
        {
            levelTimer = 120.0f;
        }

        audioSource = transform.GetComponent<AudioSource>();

        audioSource.clip = regularBGM;
        audioSource.Play();
    }
示例#38
0
 //override any of these functions using
 //protected override void Example () {
 ////Debug.Log("yo :)");
 //}
 //this way you can make your own class that inherits from player
 //and we can add overridable functions that most players will do the same way
 //e.g taking damage
 // Use this for initialization
 protected virtual void Start()
 {
     speed = Vector3.zero;
     UIScript = FindObjectOfType<PlayerUI>();//check if this is null when accessing, some scenes may not have it
     originalColor = this.transform.root.GetComponentInChildren<SpriteRenderer>().color;
 }
示例#39
0
    void Start()
    {
        manager = GameObject.Find("Main Camera").GetComponent<NPCManager>();

        characterController = GetComponent<CharacterController>();
        //weaponText = canvas.GetComponentInChildren<Text>();

        shield = gameObject.GetComponentInChildren<ShieldScript>();
        laser = gameObject.GetComponentInChildren<LaserScript>();
        charge = gameObject.GetComponentInChildren<ChargeScript>();
        bomb = gameObject.GetComponentInChildren<BombScript>();

        laserSound = gameObject.GetComponent<AudioSource>();

        cameraScript = GameObject.Find("Main Camera").GetComponent<CameraFollow>();

        futurePosition = GetComponentInChildren<FuturePositionScript>().transform;

        if (Input.GetJoystickNames().Length > 0)
        {
            isControllerConnected = true;
        }

        transform.position = spawnPoint;

        if (GameObject.Find("PlayerUI"))
        {
            ui = GameObject.Find("PlayerUI").GetComponent<PlayerUI>();
        }
    }
示例#40
0
    private void ForwardCyclePower()
    {
        switch (currentWeapon)
        {
            case Weapon.CHARGE:
                currentWeapon = Weapon.SHIELD;
                break;

            case Weapon.BOMB:
                currentWeapon = Weapon.CHARGE;
                break;

            case Weapon.SHIELD:
                currentWeapon = Weapon.LASER;
                break;

            case Weapon.LASER:
                currentWeapon = Weapon.BOMB;
                break;

            default:
                break;
        }
        weaponSelectCooldown = 0.3f;

        if (ui == null)
        {
            ui = GameObject.Find("PlayerUI").GetComponent<PlayerUI>();
        }

        ui.RotateRight();
    }
示例#41
0
    // Use this for initialization
    void Start()
    {
        playerLocation = GameObject.Find("Player").transform;
        target = new Vector3(0, 0, 0);
        ui = GameObject.Find("PlayerUI").GetComponent<PlayerUI>();

        skinMeshRenderer = GetComponentInChildren<SkinnedMeshRenderer>();

        shooter = GameObject.Find("shooter");

        laser = gameObject.GetComponentInChildren<BossLaser>();

        chargerRenderer = GameObject.Find("Charger").GetComponent<Renderer>();
        chargerCollider = GameObject.Find("Charger").GetComponent<Collider>();

        cocoonCollider = gameObject.GetComponentsInChildren<Collider>()[1];
        cocoonRenderer = gameObject.GetComponentInChildren<MeshRenderer>();

        bossType = BossType.NULL;

        followingPlayer = false;

        chargerRenderer.enabled = false;
        chargerCollider.enabled = false;
    }
示例#42
0
    void Initialize()
    {
        initialized = true;

        if (camera)
        {
          cameraController = camera.GetComponent<CameraController>();
          cameraPivotTrans = camera.transform;
          cam = Camera.main;
          camTrans = cam.transform;
        }

        if (player)
        {
          playerTrans = player.transform;
          playerMovement = player.GetComponent<PlayerMovement>();
          playerUI = player.GetComponent<PlayerUI>();
          playerActions = player.GetComponent<PlayerActions>();
          networkBus = player.GetComponent<NetworkBus>();
        }
        else
          Debug.LogError("No player object found at Initialize()");
    }