예제 #1
0
    private void Awake()
    {
        playerID        = GetComponent <Ball>().playerID;
        playerUIManager = GameObject.Find(playerID + "UIArea").GetComponent <PlayerUIManager>();

        ball = GetComponent <Ball>();
    }
예제 #2
0
 public static void GameEsc()
 {
     SoundManager.DestroyMe(GameObject.Find("Managers/SoundManager"));
     PlayerUIManager.DestroyMe(GameObject.Find("Managers/PlayerUIManager"));
     GameManager.DestroyMe(GameObject.Find("Managers/GameManager"));
     NoaProcesser.ResetBoss();
 }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     collisionBody   = GetComponent <Rigidbody2D>();
     animator        = GetComponent <Animator>();
     playerUIManager = GetComponent <PlayerUIManager>();
     shieldManager   = shields.GetComponent <ShieldManager>();
 }
예제 #4
0
    protected override void OnSetShip()
    {
        BattleBehaviour.AddEvent(() => { ship.team.myTeam = true;

                                         if (ui == null)
                                         {
                                             ui = GameObject.FindObjectOfType <PlayerUIManager>();
                                             ui.GetRadar().SetDriver(this);

                                             uiBehaviour = ScreenManager.GetScreen <PlayerUIBehaviour>();
                                         }
                                         var shipSystem = ship.shipSystem;

                                         ski = new ShipKeyInput(shipSystem);

                                         //Get camera from watcher
                                         watcher        = GameObject.FindObjectOfType <WatcherBehaviour>();
                                         watcher.target = ship.transform;
                                         camera         = watcher.GetCamera();


                                         //reset
                                         ui.SetAimPosition(aimPoint);
                                         everyTimeFire   = false;
                                         everyTimeRotate = true;
                                         lockedEnemy     = null;

                                                                                                          //SetAim(new Vector2(.5f, .7f));

                                         BattleBehaviour.current.audioPlayer.SetListener(ship.transform); // audioPlayer is not initialized on start
                                 });
    }
예제 #5
0
    public void DeInitialize()
    {
        //If references exist, destroy their objects and nullify their references
        //Specifically destroy the objects in the opposite order of when they were instantiated to prevent null ref errors

        if (playerController != null)
        {
            Destroy(playerController.gameObject);
            playerController = null;
        }

        if (audioManager != null)
        {
            Destroy(audioManager.gameObject);
            audioManager = null;
        }

        if (playerUIManager != null)
        {
            Destroy(playerUIManager.gameObject);
            playerUIManager = null;
        }

        if (playerCameraController != null)
        {
            Destroy(playerCameraController.gameObject);
            playerCameraController = null;
        }
    }
예제 #6
0
 // Start is called before the first frame update
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
예제 #7
0
 private void Start()
 {
     rb              = GetComponent <Rigidbody>();
     animator        = GetComponent <Animator>();
     audioSource     = GetComponent <AudioSource>();
     latestPos       = this.transform.position;
     playerUIManager = GameObject.Find("PlayerUICanvas").GetComponent <PlayerUIManager>();
 }
예제 #8
0
 public void Equip()
 {
     playerController = GetComponentInParent <PlayerController>();
     //playerController.PickUpGun();
     playerUIManager = playerController.GetUIManager();
     playerUIManager.ChangeGunAmmoUI(clipAmmo, maxClipAmmo);
     playerUIManager.ChangeGunUI(gunName);
 }
 private void Awake()
 {
     isMe            = photonView.IsMine;
     animator        = GetComponent <Animator>();
     movement        = GetComponent <Movement>();
     combat          = GetComponent <Combat>();
     playerUIManager = GetComponentInChildren <PlayerUIManager>();
 }
예제 #10
0
    private void Start()
    {
        instance = this;

        for (int i = 0; i < npcImages.Length; i++)
        {
            npcImages[i].color = Color.black;
        }
    }
예제 #11
0
    // Builds the player's starting deck
    private void AssignInitialDeck()
    {
        playerDeck    = new Deck();
        Deck.instance = playerDeck;

        if (puim == null)
        {
            puim = GetComponent <PlayerUIManager>();
        }

        // Placeholder cards.
        Card slash = CardFactory.GetCard("slash");

        slash.Owner = this;
        Card cinders = CardFactory.GetCard("cinders");

        cinders.Owner = this;
        Card footwork = CardFactory.GetCard("Footwork");

        footwork.Owner = this;
        Card dragonheart = CardFactory.GetCard("dragonheart");

        dragonheart.Owner = this;
        playerDeck.InsertCardAtEndOfDrawPile(slash);
        playerDeck.InsertCardAtEndOfDrawPile(slash);
        playerDeck.InsertCardAtEndOfDrawPile(slash);
        playerDeck.InsertCardAtEndOfDrawPile(slash);
        playerDeck.InsertCardAtEndOfDrawPile(slash);
        playerDeck.InsertCardAtEndOfDrawPile(footwork);
        playerDeck.InsertCardAtEndOfDrawPile(footwork);
        playerDeck.InsertCardAtEndOfDrawPile(cinders);
        playerDeck.InsertCardAtEndOfDrawPile(cinders);
        playerDeck.InsertCardAtEndOfDrawPile(dragonheart);

        if (false) // Debugging testing certain cards.
        {
            Card card1 = CardFactory.GetCard("celerity");
            card1.Owner = this;
            playerDeck.InsertCardAtEndOfDrawPile(card1);
            playerDeck.InsertCardAtEndOfDrawPile(card1);

            Card card2 = CardFactory.GetCard("sagacity");
            card2.Owner = this;
            playerDeck.InsertCardAtEndOfDrawPile(card2);
            playerDeck.InsertCardAtEndOfDrawPile(card2);

            Card card3 = CardFactory.GetCard("blockade");
            card3.Owner = this;
            playerDeck.InsertCardAtEndOfDrawPile(card3);
            playerDeck.InsertCardAtEndOfDrawPile(card3);
        }


        playerDeck.ShuffleDeck();
        DrawToHandLimit();
    }
예제 #12
0
    private void Awake()
    {
        if (Main)
        {
            LogMsg("A PlayerUIManager already exists. Deleting new duplicate instance from " + gameObject.name);
            Destroy(this);
        }

        Main = this;
    }
예제 #13
0
    public static void DestroyMe(GameObject _gameObject)
    {
        pc1Canvas = new PCCanvas();
        pc2Canvas = new PCCanvas();

        inst.MyProc.Reset();
        inst = null;
        Debug.Log("Destroy:PlayerUIManager");
        Destroy(_gameObject);
    }
예제 #14
0
    /**
     * *Important
     * TODO
     * ! ALERT
     * ? QUERY
     * DEAD
     */

    #region Setup
    public virtual void Start()
    {
        playerCollision    = GetComponent <PlayerCollisions>();
        playerAnimation    = GetComponent <PlayerAnimation>();
        playerUIManager    = GetComponent <PlayerUIManager>();
        playerStateMachine = GetComponent <PlayerStateMachine>();

        cameraShake = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraShake>();

        playerGO = this.gameObject;
    }
예제 #15
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
예제 #16
0
    //private bool CanSpin =>

    protected override void Awake()
    {
        base.Awake();
        _stamina     = _maxStamina;
        _mellee      = GetComponentInChildren <MelleeWeapon>();
        _pUIMngr     = GetComponent <PlayerUIManager>();
        moveAxis     = Vector2.zero;
        _inputMaster = new InputManager();
        _inputMaster.Player.Movement.performed   += ctx => moveAxis = ctx.ReadValue <Vector2>();
        _inputMaster.Player.WeaponSpin.performed += ctx => _weaponSpinAxis = ctx.ReadValue <float>();
    }
예제 #17
0
    private void Awake()
    {
        levelManager = FindObjectOfType <LevelManager>();
        playerID     = GetComponent <Ball>().playerID;

        ballSpeedBoost  = GetComponent <BallSpeedBoost>();
        ball            = GetComponent <Ball>();
        triggerCollider = gameObject.GetComponentInChildren <CircleCollider2D>();

        playerUIManager = GameObject.Find(playerID + "UIArea").GetComponent <PlayerUIManager>();
    }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
예제 #19
0
    void Start()
    {
        playerUI        = GetComponent <PlayerUIManager>();
        playerUI.player = this;

        cam = Camera.main;
        rig = GetComponent <Rigidbody2D>();

        stats = new Stat(moveSpeed, cam.orthographicSize, 1);

        StartCoroutine(Shoot());
    }
예제 #20
0
파일: Player.cs 프로젝트: sherr-99/YMMD
 private void Awake()
 {
     sprite   = GetComponent <SpriteRenderer>();
     animator = GetComponent <Animator>();
     //speed *= 0.001f;
     uiManager = GetComponent <PlayerUIManager>();
     inventory = new Inventory();
     if (uiInventory)
     {
         uiInventory.SetInventory(inventory);
     }
     rb = gameObject.GetComponent <Rigidbody2D>();
     inventory.SetItemList(StaticInventory.ItemArry);
 }
예제 #21
0
    private void Start()
    {
        controller            = GetComponent <CharacterController>();
        playerUIManagerScript = GetComponent <PlayerUIManager>();

        // Get the mouse sensibility.
        if (PlayerPrefs.HasKey("MouseSensibility"))
        {
            SetSensibility(PlayerPrefs.GetFloat("MouseSensibility"));
        }
        else
        {
            SetSensibility(ParameterManager.Instance.DefaultSensibility);
        }
    }
예제 #22
0
    void Start()
    {
        shotLine         = GetComponent <LineRenderer>();
        playerController = GetComponentInParent <PlayerController>();
        if (playerController != null)
        {
            playerUIManager = playerController.GetUIManager();
            playerUIManager.ChangeGunAmmoUI(maxClipAmmo, maxClipAmmo);
        }
        gi = GetComponent <GunInteractable>();

        canFire   = true;
        reloading = false;
        clipAmmo  = maxClipAmmo;
    }
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(this.gameObject);
        }
        DontDestroyOnLoad(this.gameObject);

        lightAnim   = GetComponent <Animator>();
        soundSource = GetComponent <AudioSource>();
        soundPlay   = false;
    }
예제 #24
0
 private void Awake()
 {
     if (PlayerUIManager.puim == null)
     {
         PlayerUIManager.puim = this;
     }
     else
     {
         if (PlayerUIManager.puim != this)
         {
             Destroy(PlayerUIManager.puim.gameObject);
             PlayerUIManager.puim = this;
         }
     }
     DontDestroyOnLoad(PlayerUIManager.puim.gameObject);
 }
예제 #25
0
    //Called once when the script is created
    void Start()
    {
        characterController = GetComponent <CharacterController>();
        playerHealth        = GetComponent <Health>();
        gun = GetComponentInChildren <Gun>();

        playerUIManager = new PlayerUIManager(healthSlider, healthText, ammoText, gunText, controlsPanel, gun);

        joystick = FindObjectOfType <Joystick>();

        camera.GetComponent <CameraController>().SetPlayer(this.gameObject);
        camera.GetComponent <CameraController>().SetPlayerGun(gun.gameObject);

        if (joystick != null)
        {
            joystick.player = this;
        }
    }
    // Called by the opponent, sets references to the game manager and to the player script itself.
    public void SetupGun(GameManager gms, Entity e)
    {
        gameManagerScript = gms;
        ownerEntityScript = e;

        playerUIManagerScript = null;
        hasUI = false;

        ammoInCharger = chargerSize;
        totalAmmo     = maximumAmmo / 2 - chargerSize;

        defaultAmmoInCharger = ammoInCharger;
        defaultTotalAmmo     = totalAmmo;

        if (hasUI)
        {
            gunUIManagerScript.SetAmmo(ammoInCharger, infinteAmmo ? -1 : totalAmmo);
        }
    }
예제 #27
0
파일: TankData.cs 프로젝트: mrradd/Tanxz
    /****************************************************************************
    * Unity Methods
    ****************************************************************************/
    /****************************************************************************
     * Awake */
    /**
     ****************************************************************************/
    void Awake()
    {
        hp = baseHP;

        /** Get the audio source. */
        if (audioSource == null)
        {
            audioSource = gameObject.GetComponent <AudioSource>();
        }

        /** Adjust Camera if multiplayer. AI should not have cameras. */
        if (GameManager.instance.multiPlayer && tankCam != null)
        {
            /** Adjust the camera to make split screen. */
            if (playerNumber == 1)
            {
                tankCam.rect = new Rect(0f, .5f, 1f, .5f);
            }
            if (playerNumber == 2)
            {
                tankCam.rect = new Rect(0f, 0f, 1f, .5f);
            }

            /** Adjust the UI so it is viewable by the player. */
            PlayerUIManager p = gameObject.GetComponent <PlayerUIManager>();

            Transform     dhT     = p.doomHead.transform;
            RectTransform hpRT    = p.txtHP.gameObject.GetComponent <RectTransform>();
            RectTransform scoreRT = p.txtScore.gameObject.GetComponent <RectTransform>();
            RectTransform livesRT = p.txtLives.gameObject.GetComponent <RectTransform>();

            float newDHY    = dhT.localPosition.y * .4f;
            float newDHX    = dhT.localPosition.x - 875f;
            float newHPY    = hpRT.localPosition.y * .3f;
            float newScoreY = scoreRT.localPosition.y * .45f;
            float newLivesY = livesRT.localPosition.y * .5f;

            dhT.localPosition     = new Vector3(newDHX, newDHY, dhT.position.z);
            hpRT.localPosition    = new Vector2(hpRT.localPosition.x, newHPY);
            scoreRT.localPosition = new Vector2(scoreRT.localPosition.x, newScoreY);
            livesRT.localPosition = new Vector2(livesRT.localPosition.x, newLivesY);
        }
    }
예제 #28
0
    protected override IEnumerator Start()
    {
        // f:初期設定
        PlayerManager     plm  = PlayerManager.Inst;
        SoundManager      sm   = SoundManager.Inst;
        AppearManager     am   = AppearManager.Inst;
        PauseManager      pm   = PauseManager.Inst;
        ResultManager     rm   = ResultManager.Inst;
        BackGroundManager bm   = BackGroundManager.Inst;
        GameManager       gm   = GameManager.Inst;
        PlayerUIManager   puim = PlayerUIManager.Inst;

        // f:

        Debug.Log("1:target_loadingを生成する。");
        Instantiate(Resources.Load("Prefabs/target_loading"), GameObject.Find("LoadingCanvas").transform).name = "target_loading";

        plm.Starting();

        // TimeLimitの生成
        Instantiate(Resources.Load(ResourcesPath.Ui("TimeLimitCanvas")), GameObject.Find(CanvasName.UI).transform);

        sm.Starting();
        am.Starting();
        // yield return new WaitUntil(() => plm.MyProc.started && sm.MyProc.started && am.MyProc.started);

        yield return(pm.Starting());

        rm.Starting();
        bm.Starting();

        GameManager.SetPCName(CharacterSelectManager.PC1Name ?? PC1Name, PlayerSlot.PC1);
        GameManager.SetPCName(CharacterSelectManager.PC2Name ?? PC2Name, PlayerSlot.PC2);
        gm.Starting();

        yield return(new WaitUntil(() => GameManager.Pc1Player.MyProc.started && GameManager.Pc2Player.MyProc.started));

        puim.Starting();

        MyProc.started = true;

        Destroy(gameObject);
    }
    // Called by player, sets references to the game manager, to the player script itself and to
    // the player UI.
    public void SetupGun(GameManager gms, Entity e, PlayerUIManager puims, int id)
    {
        gameManagerScript     = gms;
        ownerEntityScript     = e;
        playerUIManagerScript = puims;

        ammoInCharger        = chargerSize;
        totalAmmo            = maximumAmmo / 2 - chargerSize;
        defaultAmmoInCharger = ammoInCharger;
        defaultTotalAmmo     = totalAmmo;

        gunId = id;

        if (hasUI)
        {
            gunUIManagerScript = GetComponent <GunUIManager>();
            gunUIManagerScript.SetAmmo(ammoInCharger, infinteAmmo ? -1 : totalAmmo);
        }
    }
예제 #30
0
    void Initialize()
    {
        //Don't execute if not the local player
        if (!isLocalPlayer)
        {
            return;
        }

        //If the playerCameraController reference is null, create the player
        if (playerCameraController == null)
        {
            playerCameraController            = Instantiate(playerCameraControllerPrefab).GetComponent <PlayerCameraController>();
            playerCameraController.playerBody = this;
            playerCameraController.SetFollowTarget(transform);
        }

        //If the playerUIManager reference is null, create the canvas
        if (playerUIManager == null)
        {
            playerUIManager            = Instantiate(playerUIManagerPrefab).GetComponent <PlayerUIManager>();
            playerUIManager.playerBody = this;
            //playerUIManager.playerCamera = playerCameraController.activeCam;
        }

        //If the audioManager reference is null, create the canvas
        if (audioManager == null)
        {
            audioManager            = Instantiate(audioManagerPrefab).GetComponent <AudioManager>();
            audioManager.playerBody = this;
        }

        //If the playerBody reference is null, create the player
        if (playerController == null)
        {
            playerController                        = Instantiate(playerControllerPrefab, Vector3.zero, Quaternion.identity).GetComponent <PlayerController>();
            playerController.playerBody             = this;
            playerController.playerCameraController = playerCameraController;
            playerController.playerUIManager        = playerUIManager;
            //playerController.CallOnEnable(); <--- Replaced by Start()
        }
    }