//trigger detection for enemy ships and coins.
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.tag == "UpgradeCoin")
     {
         //Debug.Log ("Trigger Collision: " + col.tag);
         CoinValue value = col.gameObject.GetComponent <CoinValue> ();
         PlayerStatsManager.SetPlayerScore(value.GetCoinValue());
         value.PassUpgradeValue();
         Destroy(col.gameObject);
     }
     if (col.tag == "Enemy Ship" || col.tag == "EliteEnemyShip")
     {
         PlayerStatsManager.SetPlayerHealth(-enemyCollisionDamage);
         EnemyAI collide = col.gameObject.GetComponent <EnemyAI> ();
         if (col.tag == "EliteEnemyShip")
         {
             collide.SetDamage(5f);
         }
         else
         {
             collide.SetDamage(100f);
         }
         hurtSound.Play();
     }
 }
Пример #2
0
    //public GameObject successfulPanel;


    // Use this for initialization
    void Start()
    {
        lSpawner           = FindObjectOfType <locationSpawner>();
        playerStatsManager = FindObjectOfType <PlayerStatsManager>();
        cardDisplay        = FindObjectOfType <CardDisplay>();
        //officerCard = FindObjectOfType<OfficerCard>();
        //successfulPanel.SetActive(false);
    }
Пример #3
0
    private PlayerStatsManager _instance; //Declare instance variable

    //Begin Singleton Constructor
    public PlayerStatsManager Instance()
    {
        if (_instance == null)
        {
            _instance = new PlayerStatsManager();
        }
        return(_instance);
    }//End Singleton Constructor
Пример #4
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(this);
     }
     instance = this;
 }
Пример #5
0
    void UpdateSpeed()
    {
        var speedLevel = PlayerStatsManager.GetSpeedLevel();

        for (int i = 0; i < speedLevel; i++)
        {
            speedButtons[i].interactable = false;
        }
        speedCostText.text = speedCosts[speedLevel].ToString();
    }
Пример #6
0
    void UpdateJumpForce()
    {
        var jumpForceLevel = PlayerStatsManager.GetJumpForceLevel();

        for (int i = 0; i < jumpForceLevel; i++)
        {
            jumpForceButtons[i].interactable = false;
        }
        jumpForceCostText.text = jumpForceCosts[jumpForceLevel].ToString();
    }
Пример #7
0
    void UpdateDoubleJump()
    {
        var doubleJumpLevel = PlayerStatsManager.GetDoubleJumpLevel();

        if (doubleJumpLevel == 1)
        {
            doubleJumpButton.interactable = false;
        }
        doubleJumpCostText.text = doubleJumpCost.ToString();
    }
Пример #8
0
    void Start()
    {
        target       = GameObject.FindGameObjectWithTag("location");
        returnTarget = null;
        NavMeshAgent agent = GetComponent <NavMeshAgent>();

        agent.destination = target.transform.position;

        playerStatsManager = FindObjectOfType <PlayerStatsManager>();
    }
 //Update the player Upgrade Score. 20 points is the max. Modulus used to divide tiers into x/10 slices.
 void Update()
 {
     if (PlayerStatsManager.GetUpgradePoints() == 20f)
     {
         upgradeCounter.text = "Next Upgrade: MAX";
     }
     else
     {
         upgradeCounter.text = "Next Upgrade: " + PlayerStatsManager.GetUpgradePoints() % 10 + "/10";
     }
 }
Пример #10
0
    private void Start()
    {
        playerStats = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStatsManager>();

        if (playerStats)
        {
            currentHealth           = playerStats.currentHealth;
            maxHealth               = playerStats.maxHealth;
            healthWarningThreashold = playerStats.lowHealthThreshold;
        }
    }
Пример #11
0
    void Start()
    {
        // TODO: instantiate this based on player's save game data.
        var saveData = GameManager.Instance.saveData;

        // Remove example items from hierarchy.
        gridLayoutGroup.gameObject.DestroyAllChildren();

        // Assign dynamic component references.
        playerStatsManager = FindObjectOfType <PlayerStatsManager>();
        UpdatePlayerCurrency(saveData.currency);

        itemsOwned = playerStatsManager.GetItemsOwned();
        foreach (var item in itemsOwned)
        {
            Debug.Log($"owned: {item.name}");
        }
        // itemsOwned = new List<ScriptableObject>();
        // itemsOwned =

        // Register purchase button event.
        purchaseButton.onClick.AddListener(() => PurchaseItem());

        exitButton.onClick.AddListener(() =>
        {
            SceneManager.UnloadSceneAsync("Scenes/Store");
        });

        if (playerStatsManager == null)
        {
            Debug.LogError("No player stats manager found, StoreUI cannot function correctly");
        }

        // Create UI entries for each unpurchased item.
        for (var i = 0; i < storeInventory.Length; i++)
        {
            var item = storeInventory[i];
            if (!itemsOwned.Contains(item))
            {
                var storeEntry = Instantiate(storeItemPrefab, gridLayoutGroup);
                var storeItem  = storeEntry.GetComponent <StoreItem>();
                storeItem.SetItem(item);
                storeEntry.GetComponent <Button>().onClick.AddListener(() => SetSelection(storeEntry));
                storeEntry.name = storeItem.GetItem().name;
            }
        }

        // Set initially selected element for event system.
        var initialSelection = gridLayoutGroup.childCount > 0
            ? gridLayoutGroup.GetChild(0).gameObject
            : exitButton.gameObject;

        EventSystem.current.SetSelectedGameObject(initialSelection);
    }
Пример #12
0
    void Start()
    {
        rigidbodyComponent = gameObject.GetComponent <Rigidbody>();
        cameraController   = GameObject.Find("CamPos").GetComponent <CameraController>();
        playerStatsManager = GameObject.Find("PlayerStatsManager").GetComponent <PlayerStatsManager>();
        playManager        = GameObject.Find("PlayManager").GetComponent <PlayManager>();



        cameraController.SetTarget(transform.position);//  offset to tips
        // StartCoroutine(CamMoveToTips());
    }
Пример #13
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
    private void AddDefaultManagers()
    {
        if (gameManager == null)
        {
            gameManager = gameObject.AddComponent <GameManager>();
        }

        if (playerStatsManager == null)
        {
            playerStatsManager = gameObject.AddComponent <PlayerStatsManager>();
        }
    }
 //Checks condition for player explosion
 private void Explode()
 {
     if (PlayerStatsManager.GetPlayerHealth() < 1f && PlayerStatsManager.GetCanSpawn())
     {
         GameObject anim       = Instantiate(explosionPrefab) as GameObject;
         Vector2    spawnPoint = new Vector2(transform.position.x, transform.position.y);
         anim.transform.position = spawnPoint;
         PlayerStatsManager.DecrementPlayerLives(1f);
         explosionSound.Play();
         Spawn();
     }
 }
Пример #16
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         PlayerStatsManager playerStatsScript = collision.gameObject.GetComponent <PlayerStatsManager>();
         playerStatsScript.currentOxygen += playerStatsScript.oxygenAcquiredPerSheep;
         if (playerStatsScript.currentOxygen > playerStatsScript.maxOxygen)
         {
             playerStatsScript.currentOxygen = playerStatsScript.maxOxygen;
         }
         Destroy(gameObject);
     }
 }
Пример #17
0
    void Start()
    {
        // Initiate the animator.
        anim = GetComponent <Animator>();

        // Initiate the particle effect controller.
        particle = FindObjectOfType <ParticleController>();

        // Initiate the Save Manager.
        save = FindObjectOfType <PlayerStatsManager>();

        // Initiate the UI Controller.
        ui = FindObjectOfType <LevelUIController>();
    }
Пример #18
0
    private void Awake()
    {
        controller           = GetComponent <CharacterController>();
        statsManager         = GetComponent <PlayerStatsManager>();
        iScanner             = GetComponent <InteractableScanner>();
        playerObjectInteract = GetComponent <PlayerObjectInteract>();
        alignCamera          = Camera.main.transform;

        bat.SetActive(false);
        dracula.SetActive(true);

        CurrentStamina            = stats.MaxStamina;
        MenuManager.OnLevelStart += ResetStamina;
    }
Пример #19
0
    // Use this for initialization
    void Start()
    {
        playerStatsManager = FindObjectOfType <PlayerStatsManager> ();

        playerMovement = FindObjectOfType <PlayerMovement>();
        // all of the public variables are set when the game is start //
        nameText.text        = officerCard.name;
        descriptionText.text = officerCard.description;

        displayImage.sprite = officerCard.image;

        costText.text  = officerCard.moneyCost.ToString();
        levelText.text = officerCard.level.ToString();
        xpText.text    = officerCard.xp.ToString();
    }
 //Spawn player on death if there are lives left.
 private void Spawn()
 {
     if (PlayerStatsManager.GetPlayerLives() > 0f)
     {
         Vector2 startPos = new Vector2(-5.3f, 0f);
         transform.position = startPos;
         PlayerStatsManager.SetPlayerHealth(maxHealth);
         PlayerStatsManager.SetUpgradePoints(-10f);
     }
     else
     {
         PlayerStatsManager.SetCanSpawn(false);
         SceneManager.LoadScene("game_over");
         Destroy(gameObject);
     }
 }
Пример #21
0
    private void Awake()
    {
        PlayerStatsManager = GameObject.Find("GameStateManager").GetComponent <PlayerStatsManager>();

        if (PlayerStatsManager == null)
        {
            throw new MissingComponentException("Can't find PlayerStatsManager!");
        }

        CurrentText = GetComponent <Text>();

        if (CurrentText == null)
        {
            throw new MissingComponentException("Can't find CurrentText!");
        }
    }
Пример #22
0
    private void Start()
    {
        // 本地初始化项
        player             = null;
        curBreathCount     = breathCount;
        this.scaleCtrlPosY = transform.position.y;

        // 子组件
        enemy_Giant_Face = transform.Find("Face").GetComponent <Enemy_Giant_Face>();
        health           = GetComponent <Health>();

        // 全局组件
        mainCameraCMP      = GameObject.Find("CamPos").GetComponent <CameraController>();
        playManager        = GameObject.Find("PlayManager").GetComponent <PlayManager>();
        playerStatsManager = GameObject.Find("PlayerStatsManager").GetComponent <PlayerStatsManager>();
    }
Пример #23
0
    // Start is called before the first frame update
    private void Awake()
    {
        DontDestroyOnLoad(transform.gameObject);
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        player  = GameObject.FindObjectOfType <PlayerStatsManager>();
        spawner = GameObject.FindObjectOfType <WaveSpawner>();
        //spawner = GameObject
    }
Пример #24
0
    // Update is called once per frame
    void Update()
    {
        if (player == null || spawner == null)
        {
            player  = GameObject.FindObjectOfType <PlayerStatsManager>();
            spawner = GameObject.FindObjectOfType <WaveSpawner>();
        }


        if (SceneManager.GetActiveScene().buildIndex == 1)
        {
            playerScore = player.getCurrentScore();
            waveCount   = spawner.getCurrentWave();
        }
        Debug.Log(playerScore + ", " + waveCount);
    }
Пример #25
0
    private void Awake()
    {
        FiniteStateMachine = new PlayerFiniteStateMachine();
        SkillManager       = new PlayerSkillsManager();
        StatsManager       = new PlayerStatsManager(_playerStatsData);

        IdleState = new PlayerIdleState(this, FiniteStateMachine, "idle", _idleStateData);
        MoveState = new PlayerMoveState(this, FiniteStateMachine, "move", _moveStateData);

        LandState  = new PlayerLandState(this, FiniteStateMachine, "land");
        JumpState  = new PlayerJumpState(this, FiniteStateMachine, "inAir", _jumpStateData);
        InAirState = new PlayerInAirState(this, FiniteStateMachine, "inAir", _inAirStateData);

        WallSlideState  = new PlayerWallSlideState(this, FiniteStateMachine, "wallSlide", _wallSlideStateData);
        WallGrabState   = new PlayerWallGrabState(this, FiniteStateMachine, "wallGrab");
        WallClimbState  = new PlayerWallClimbState(this, FiniteStateMachine, "wallClimb", _wallClimbStateData);
        WallJumpState   = new PlayerWallJumpState(this, FiniteStateMachine, "inAir", _wallJumpStateData);
        LedgeClimbState = new PlayerLedgeClimbState(this, FiniteStateMachine, "ledgeClimbState", _ledgeClimbStateData);

        DashState = new PlayerDashState(this, FiniteStateMachine, "inAir", _dashStateData);
        RollState = new PlayerRollState(this, FiniteStateMachine, "rollState", _rollStateData);

        CrouchIdleState = new PlayerCrouchIdleState(this, FiniteStateMachine, "crouchIdle", _crouchIdleStateData);
        CrouchMoveState = new PlayerCrouchMoveState(this, FiniteStateMachine, "crouchMove", _crouchMoveStateData);

        OnRopeStateAim    = new PlayerOnRopeState_Aim(this, FiniteStateMachine, "idle", _onRopeStateData);
        OnRopeStateAttach = new PlayerOnRopeState_Attach(this, FiniteStateMachine, "inAir", _onRopeStateData);
        OnRopeStateMove   = new PlayerOnRopeState_Move(this, FiniteStateMachine, "inAir", _onRopeStateData);
        OnRopeStateFinish = new PlayerOnRopeState_Finish(this, FiniteStateMachine, "inAir", _onRopeStateData);

        SwordAttackState01 = new PlayerSwordAttackState_01(this, FiniteStateMachine, "swordAttack01", _swordAttackPosition01,
                                                           _swordAttackStateData01);
        SwordAttackState02 = new PlayerSwordAttackState_02(this, FiniteStateMachine, "swordAttack02", _swordAttackPosition02,
                                                           _swordAttackStateData02);
        SwordAttackState03 = new PlayerSwordAttackState_03(this, FiniteStateMachine, "swordAttack03", _swordAttackPosition03,
                                                           _swordAttackStateData03);

        FireArrowShotStateStart = new PlayerBowFireArrowShotState_Start(this, FiniteStateMachine, "bowFireShotStart",
                                                                        _fireArrowShotAttackPosition, _fireArrowShotStateData);
        FireArrowShotStateAim = new PlayerBowFireArrowShotState_Aim(this, FiniteStateMachine, "bowFireShotAim",
                                                                    _fireArrowShotAttackPosition, _fireArrowShotStateData);
        FireArrowShotStateFinish = new PlayerBowFireArrowShotState_Finish(this, FiniteStateMachine, "bowFireShotFinish",
                                                                          _fireArrowShotAttackPosition, _fireArrowShotStateData);

        StunState = new PlayerStunState(this, FiniteStateMachine, "stun", StunStateData);
        DeadState = new PlayerDeadState(this, FiniteStateMachine, "dead", _deadStateData);
    }
Пример #26
0
    private IEnumerator SuckingBlood(int bloodPerSec, float tickRate)
    {
        PlayerStatsManager playerStats = player.GetComponent <PlayerStatsManager>();

        AudioManager.instance.PlaySound(SoundType.DraculaBite);
        while (npcController.CurrentHealth > 0)
        {
            npcController.DecreaseHealth(bloodPerSec);
            playerStats.IncreaseSatiationValue(bloodPerSec);
            playerStats.IncreaseHealthValue(bloodPerSec);
            Debug.Log("Currently Drinking!");
            yield return(new WaitForSeconds(tickRate));

            AudioManager.instance.PlaySound(SoundType.DraculaDrink);
        }
        player.SuckingBlood = false;
        AudioManager.instance.PlaySound(SoundType.DraculaDrinkDone);
        npcController.Dead();
    }
Пример #27
0
    void UnlockAbility(string name, int level)
    {
        int currentLevel;
        var availableCoins = PlayerPrefsManager.GetCoins();

        switch (name)
        {
        case "Double Jump":
            currentLevel = PlayerStatsManager.GetDoubleJumpLevel();
            if (level == currentLevel + 1 && availableCoins >= doubleJumpCost)
            {
                PlayerStatsManager.SetDoubleJumpLevel(level);
                PlayerPrefsManager.SetCoins(availableCoins - doubleJumpCost);
            }
            UpdateDoubleJump();
            break;

        case "Speed":
            currentLevel = PlayerStatsManager.GetSpeedLevel();
            if (level == currentLevel + 1 && level - 1 < speedCosts.Length && availableCoins >= speedCosts[level - 1])
            {
                PlayerStatsManager.SetSpeedLevel(level);
                PlayerPrefsManager.SetCoins(availableCoins - speedCosts[level - 1]);
            }
            UpdateSpeed();
            break;

        case "Jump Force":
            currentLevel = PlayerStatsManager.GetJumpForceLevel();
            if (level == currentLevel + 1 && level - 1 < jumpForceCosts.Length && availableCoins >= jumpForceCosts[level - 1])
            {
                PlayerStatsManager.SetJumpForceLevel(level);
                PlayerPrefsManager.SetCoins(availableCoins - jumpForceCosts[level - 1]);
            }
            UpdateJumpForce();
            break;

        default:
            Debug.LogError("Ability " + name + " not recognized");
            break;
        }
        UpdateCoins();
    }
Пример #28
0
        public ActionResult Player(PlayerStatsFilterViewModel model)
        {
            ViewBag.PlayerItems = listItems.Players();
            ViewBag.SeasonItems = listItems.Seasons();

            if (model.Player == 0 && model.Season == 0)
            {
                model.Season = Convert.ToInt64(ViewBag.SeasonItems[0].Value);
                model.Player = Convert.ToInt64(ViewBag.PlayerItems[0].Value);
            }

            ViewBag.CompetitionItems = listItems.CompetitionsOfPlayer(model.Player);

            IList <PlayerStats> stats = psdao.GetByFilter(model);

            PlayerStatsManager gsm = new PlayerStatsManager(stats);

            ViewBag.Stats      = gsm.OverAllStats();
            ViewBag.RadarStats = gsm.StatsForRadarChart();
            return(View());
        }
Пример #29
0
    // Update is called once per frame
    void Update()
    {
        if ((Input.GetKey(KeyCode.Space) && Time.time > fireCoolDown) || (Input.GetKeyDown(KeyCode.Space)))
        {
            if (PlayerStatsManager.GetUpgradePoints() < 10)
            {
                Shoot(0);
            }

            if (PlayerStatsManager.GetUpgradePoints() >= 10)
            {
                Shoot(1);
            }

            if (PlayerStatsManager.GetUpgradePoints() >= 20)
            {
                Shoot(2);
            }

            fireCoolDown = Time.time + fireRate;
        }
    }
    void Awake()
    {
        // get a reference to the components we are going to be changing and store a reference for efficiency purposes
        _transform = GetComponent <Transform>();

        _rigidbody = GetComponent <Rigidbody2D>();
        if (_rigidbody == null) // if Rigidbody is missing
        {
            Debug.LogError("Rigidbody2D component missing from this gameobject");
        }

        _animator = GetComponent <Animator>();
        if (_animator == null) // if Animator is missing
        {
            Debug.LogError("Animator component missing from this gameobject");
        }

        _audio = GetComponent <AudioSource>();
        if (_audio == null)
        { // if AudioSource is missing
            Debug.LogWarning("AudioSource component missing from this gameobject. Adding one.");
            // let's just add the AudioSource component dynamically
            _audio = gameObject.AddComponent <AudioSource>();
        }

        // determine the player's specified layer
        _playerLayer = this.gameObject.layer;

        // determine the platform's specified layer
        _platformLayer = LayerMask.NameToLayer("Platform");

        // get stats from stats manager
        moveSpeed            = PlayerStatsManager.GetSpeed();
        jumpForce            = PlayerStatsManager.GetJumpForce();
        doubleJumpIsUnlocked = PlayerStatsManager.GetDoubleJump();
    }
 void Awake()
 {
     Instance = this;
 }