/// <summary>
    /// Computes number of summons to make and subtract the resource from stat. returns 0 if can't afford.
    /// </summary>
    public int ApplySummon(PlayerStat stat)
    {
        if(isReady) {
            int available = GetNumSummonable(stat.flockGroup);

            int numSummonable = available > data.summonAmount ? data.summonAmount : available;

            float cost = data.resource*((float)numSummonable);

            //adjust cost and summon amount if too expensive
            if(cost > stat.curResource) {
                numSummonable = Mathf.FloorToInt(stat.curResource/data.resource);
                cost = data.resource*((float)numSummonable);
            }

            if(numSummonable > 0) {
                //assumes there's nothing that will cancel the summon queue while player is alive
                stat.curResource -= cost;

                UpdateSummonQueueAmount(numSummonable);

                curTime = 0;

                return numSummonable;
            }
        }

        return 0;
    }
Example #2
0
 void KillEventTrigger(PlayerStat playerStat)
 {
     if (playerStat != null)
     {
         TryStopLifeChange();
     }
 }
Example #3
0
    // Use this for initialization
    void Start()
    {
        m_RigidBody = GetComponent<Rigidbody2D> ();
        m_PlayerStat = GetComponent<PlayerStat> ();
        InputManager.Instance.OnInputUpdated += OnInputUpdated;

        SetDefaultSpeedAndDrag ();
    }
Example #4
0
 IEnumerator ChangeLife(PlayerStat aPlayerStat)
 {
     do
     {
         aPlayerStat.ChangeHealth(m_QuantityToChange);
         yield return new WaitForSeconds(m_WaitingTimeSec);
     } while(true);
 }
Example #5
0
    private void Start()
    {
        IsCollected = false;
        timeToLife = 1f;

        _levelManager = Camera.main.GetComponent<LevelManager>();
        _light = GameObject.FindGameObjectWithTag("Light");
        _playerStat = Camera.main.GetComponent<PlayerStat>();
    }
Example #6
0
 void DispatchEventTrigger(PlayerStat playerStat)
 {
     if (playerStat != null)
     {
         TryStopLifeChange();
         m_CoroutineLifeChanger = ChangeLife(playerStat);
         StartCoroutine(m_CoroutineLifeChanger);
     }
 }
Example #7
0
    private void Awake()
    {
        if (_pStat == null){
            _pStat = Camera.main.GetComponent<PlayerStat>();
            _pStat.LoadPersonalStats();
        }
        _jumpCount = _pStat.DoubleJump + 1;

        var v = new Vector2 {x = (_pStat.MagnetPower + 1)*0.34f, y = (_pStat.MagnetPower + 1)*0.34f};
        if (_pStat.MagnetPower == 2) v.x += 0.3f;
        GetComponent<BoxCollider2D>().size = v;
    }
Example #8
0
    private void Awake()
    {
        _hscores = GetComponent<Highscores>();
        _playerStats = GetComponent<PlayerStat>();
        _playerStats.LoadPersonalStats();
        UsernameField.text = _playerStats.Username;

        MagnetBText = MagnetB.GetComponentInChildren<Text>();
        DoubleJumpBText = DoubleJumpB.GetComponentInChildren<Text>();
        ScoreBText = ScoreB.GetComponentInChildren<Text>();

        UpdateHighscores();
    }
 private void OnTriggerExit(Collider other)
 {
     if (other.transform.tag == "Skill2" && !isOne)
     {
         if (tiber.Stat.Hp > 0)
         {
             PlayerStat playerStat = PlayerFSMManager.Instance.Stat;
             float      damage     = (playerStat.GetStr() * playerStat.dmgCoefficient[4] * 0.01f);
             StartCoroutine(display.DamageDisplaying(damage));
             CharacterStat.ProcessDamage(playerStat, tiber.Stat, damage);
         }
         isOne = true;
         Invoke("isOneSet", 1f);
     }
 }
        public void RecordClanChestStats()
        {
            Logger.Debug("Begin RecordClanChestStats");

            var clan     = GetClan();
            var members  = clan.members?.ToList();
            var database = new CRClanStatsFactory().Create();

            foreach (var member in members)
            {
                Logger.Debug($"Updating stats for {member.name}");
                Logger.Debug($"      Crowns:                        {clan.clanChest.crowns}");
                Logger.Debug($"      Role:                       {clan.clanChest.crowns}");
                Logger.Debug($"      Trophies:                   {clan.clanChest.crowns}");
                Logger.Debug($"      Arena:                      {clan.clanChest.crowns}");
                Logger.Debug($"      Current Donations:          {clan.clanChest.crowns}");
                Logger.Debug($"      Current Donations Delta:    {clan.clanChest.crowns}");
                Logger.Debug($"      Current Donations Received: {member.donationsReceived}");

                try
                {
                    var playerRecord = database.Players?.Single(p => p.Tag == member.tag);
                    var playerStat   = new PlayerStat()
                    {
                        RecordDate = DateTime.UtcNow,

                        DonationsCount         = member.donations ?? 0,
                        DonationsReceivedCount = member.donationsReceived ?? 0,
                        //DonationsDelta = member.donationsDelta ?? 0,
                        PlayerRole           = database.PlayerRoles?.Single(r => r.RoleName == member.role),
                        ClanChestCrownsCount = member.clanChestCrowns ?? 0,
                        Trophies             = member.trophies
                    };

                    playerRecord.PlayerStats.Add(playerStat);
                }
                catch (Exception ex)
                {
                    Logger.Error("Update failed", ex);
                    throw;
                }
            }

            database.SaveChanges();


            Logger.Debug("End RecordClanChestStats");
        }
Example #11
0
    protected override void Awake()
    {
        base.Awake();

        mControl = GetComponentInChildren<PlayerController>();
        mPlayerStats = GetComponentInChildren<PlayerStat>();
        mSprite = GetComponentInChildren<UnitSpriteController>();

        mPlayerStats.statChangeCallback += OnStatChange;
        //hoook to hud

        mPlayers[(int)mPlayerStats.flockGroup - playerIndOfs] = this;

        if(summonDisplay != null) summonDisplay.SetActive(false);
        if(unsummonDisplay != null) unsummonDisplay.SetActive(false);
    }
Example #12
0
 // Use this for initialization
 void Start()
 {
     thePlayerStat = FindObjectOfType <PlayerStat>();
     itemList.Add(new Item(10001, "빨간 포션", "체력을 50 회복시켜주는 기적의 물약", Item.ItemType.Use));
     itemList.Add(new Item(10002, "파란 포션", "마나를 15 회복시켜주는 기적의 물약", Item.ItemType.Use));
     itemList.Add(new Item(10003, "농축 빨간 포션", "체력을 350 회복시켜주는 기적의 농축 물약", Item.ItemType.Use));
     itemList.Add(new Item(10004, "농축 파란 포션", "마나를 80 회복시켜주는 기적의 농축 물약", Item.ItemType.Use));
     itemList.Add(new Item(11001, "랜덤 상자", "랜덤으로 포션이 나온다. 낮은 확률로 꽝", Item.ItemType.Use));
     itemList.Add(new Item(20001, "짧은 검", "기본적인 용사의 검", Item.ItemType.Equip, 3));
     itemList.Add(new Item(20002, "무딘 도끼", "기본적인 용사의 도끼", Item.ItemType.Equip, 4));
     itemList.Add(new Item(20003, "녹슨 창", "기본적인 용사의 창", Item.ItemType.Equip, 5));
     itemList.Add(new Item(20301, "사파이어 반지", "1초에 hp 1을 회복시켜주는 마법 반지", Item.ItemType.Equip, 0, 0, 1));
     itemList.Add(new Item(30001, "고대 유물의 조각 1", "반으로 쪼개진 고대 유물의 파편", Item.ItemType.Quest));
     itemList.Add(new Item(30002, "고대 유물의 조각 2", "반으로 쪼개진 고대 유물의 파편", Item.ItemType.Quest));
     itemList.Add(new Item(30003, "고대 유물", "고대 유적에 잠들어있던 고대의 유물", Item.ItemType.Quest));
 }
Example #13
0
    IEnumerator WaitingCharacter()
    {
        do
        {
            yield return(0);

            GameObject playerGO = GameObject.FindGameObjectWithTag("Player");
            if (playerGO != null)
            {
                m_PlayerStat = playerGO.GetComponentInParent <PlayerStat> ();
            }
        } while(m_PlayerStat == null);

        m_PlayerStat.OnHealthChanged += OnHealthChanged;
        OnHealthChanged();
    }
Example #14
0
        public bool Deserialize(ref PlayerStat serialized)
        {
            if (GetDataSize() == 0)
            {
                return(false);
            }

            bool ret = true;

            // 데이터의 요소별로 디시리얼라이즈합니다.
            ret &= Deserialize(ref serialized.PlayerId);
            ret &= Deserialize(ref serialized.HP);


            return(ret);
        }
Example #15
0
 private void OnStatChanged(PlayerStat changedStat, int oldValue, int newValue)
 {
     if (this.stat == changedStat)
     {
         if (newValue < oldValue)
         {
             text.fontSize = fontSizeOnStatChange;
             text.color    = colorOnStatChangeNegative;
         }
         else if (newValue > oldValue)
         {
             text.fontSize = fontSizeOnStatChange;
             text.color    = colorOnStatChangePositive;
         }
     }
 }
Example #16
0
    private void Start()
    {
        _colorToLerp     = LightSource.LightColor;
        _lastSpawnUnits  = 0;
        _spawnsCounter   = 3;
        isStatsSended    = false;
        _wasErrorNetwork = false;
        _playerStat      = GetComponent <PlayerStat>();
        _lightLogic      = Light.GetComponent <LightLogic>();
        _darkSpawn       = 0;

        ProgressBar.SetActive(true);
        WinText.gameObject.SetActive(false);
        _shadowSource = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <BeatLightScaler>();
        AudioSource.PlayClipAtPoint(NewStart, transform.position);
    }
    void OnCollisionStay2D(Collision2D aCollision)
    {
        PlayerStat playerStat = aCollision.gameObject.GetComponentInParent <PlayerStat> ();

        if (playerStat != null)
        {
            if (playerAction != null)
            {
                isActioning = playerAction.getIsActioning();
                if (isActioning)
                {
                    isBeingDragged = true;
                }
            }
        }
    }
Example #18
0
    public override void Init()
    {
        WorldObjectType = Define.WorldObject.Player;
        _guide          = gameObject.transform.Find("UI_PlayerGuide").gameObject;
        _stat           = gameObject.GetComponent <PlayerStat>();
        _rigid          = gameObject.GetComponent <Rigidbody>();
        _nav            = gameObject.GetComponent <NavMeshAgent>();
        __audioSources  = gameObject.GetComponent <AudioSource>();
        _anim           = GetComponent <Animator>();

        _guide.SetActive(false);
        Managers.Input.KeyAction   -= OnKeyBoard;
        Managers.Input.KeyAction   += OnKeyBoard;
        Managers.Input.MouseAction -= OnMouseEvent;
        Managers.Input.MouseAction += OnMouseEvent;
    }
Example #19
0
    // Start is called before the first frame update
    public override void Init()
    {
        WorldObjectType = Define.eWorldObject.Player;

        _stat = gameObject.GetComponent <PlayerStat>();
        //Managers.input.KeyAction -= OnKey;
        //Managers.input.KeyAction += OnKey;

        Managers.input.MouseAction -= OnMouseEvent;
        Managers.input.MouseAction += OnMouseEvent;

        if (gameObject.GetComponentInChildren <UI_HPBar>() == null)
        {
            Managers.UI.MakeWorldSpaceUI <UI_HPBar>(transform);
        }
    }
Example #20
0
    // Start is called before the first frame update
    void Start()
    {
        agent     = GetComponent <NavMeshAgent>();
        player    = PlayerManager.Instance.player;
        combat    = GetComponent <CharacterCombat>();
        agentStat = GetComponent <PlayerStat>();

        anim  = GetComponent <Animator>();
        audio = GetComponent <AudioSource>();

        // subscribe to the event in the player state script.
        agentStat.OnHealthReachedZero += Die;

        index = Random.Range(0, waypoints.Length - 1);
        InvokeRepeating("Patrol", 1.0f, 15f);
    }
Example #21
0
        /// <summary>
        /// Metodas kuris patikrina duomenų bazėje ar yra pasiektas naujas rekordas.
        /// </summary>
        /// <returns>Gražinama true jei rekordas buvo pasiektas, false - jei ne</returns>
        private bool NewRecord()
        {
            PlayerStat playerHighScores = new PlayerStat()
            {
                Point = Convert.ToInt32(game.GetPoints()),
                Name  = "Gyvatėlė",
                Type  = game.GetGameType(),
                Time  = levelTime
            };

            if (highScores.NewRecord(playerHighScores))
            {
                return(true);
            }
            return(false);
        }
        private int GetPlayerStatValueByStat(PlayerStat stat)
        {
            switch (stat)
            {
            case PlayerStat.STR:
                return(Str);

            case PlayerStat.DEX:
                return(Dex);

            case PlayerStat.INT:
                return(Int);

            default:
                throw new ArgumentOutOfRangeException(nameof(stat), stat, null);
            }
        }
Example #23
0
        private PlayerStat ParsePlayer(JToken item, Guid matchID)
        {
            string     name   = item["name"].ToString();
            int        kills  = item["kills"].ToObject <int>();
            int        damage = item["damageDealt"].ToObject <int>();
            PlayerStat p      = new PlayerStat()
            {
                MatchId   = matchID,
                Name      = name,
                Kills     = kills,
                AvgKills  = context.AverageKills(name, kills),
                Damage    = damage,
                AvgDamage = context.AverageDamage(name, damage) // TODO - Get this information from the database
            };

            return(p);
        }
Example #24
0
    //Start overrides the Start function of MovingObject
    protected override void Start()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        inventory  = GameObject.Find("ItemDatabase").GetComponent <Inventory>();
        playerStat = GetComponent <PlayerStat>();

        //Get a component reference to the Player's animator component
        animator = GetComponent <Animator>();

        AllObjectInRadius = new List <GameObject>();

        //Call the Start function of the MovingObject base class.
        base.Start();

        if (LoadData.instance.dataLoaded)
        {
            Load();
        }
        else//Delete soon *******************
        {
            if (inField)
            {
                int generationSize = 14;
                for (int x = -generationSize; x < generationSize + 1; x++)
                {
                    for (int y = -generationSize; y < generationSize + 1; y++)
                    {
                        //ManageTerrainGeneration((int)transform.position.x + x, (int)transform.position.y + y);
                    }
                }
            }
        }
    }
Example #25
0
        public void EndGame()
        {
            var playerStats = CreatePlayerStats();

            Array.Sort(playerStats, PlayerStat.ComparePlayerStatFromGoodToBad);
            writer.WriteLine("Game ends with the following stats:");
            PlayerStat topPlayerStat = null;

            foreach (var playerStat in playerStats)
            {
                writer.Write(playerStat.Player.Name);
                writer.Write("  Victory Points:");
                writer.Write(playerStat.TotalVictoryPoints);
                writer.Write("  Turns:");
                writer.Write(playerStat.Player.ActiveCount);

                bool isWinner;
                if (topPlayerStat != null)
                {
                    switch (playerStat.CompareWith(topPlayerStat))
                    {
                    case PlayerStatComparison.Better:
                    case PlayerStatComparison.Equal:
                        isWinner = true;
                        break;

                    default:
                        isWinner = false;
                        break;
                    }
                }
                else
                {
                    topPlayerStat = playerStat;
                    isWinner      = true;
                }
                if (isWinner)
                {
                    writer.Write("  [Winner]");
                }

                writer.WriteLine();
            }

            gameEnded = true;
        }
Example #26
0
    private bool collideDmg;    //Damage player when it collide with boss

    // Start is called before the first frame update
    void Start()
    {
        faceRight        = false;
        Fight            = false;
        stats            = GameObject.Find("Player").GetComponent <PlayerStat>();
        collideDmg       = true;
        rb               = gameObject.GetComponent <Rigidbody2D>();
        animator         = GetComponent <Animator>();
        Attacking        = false;
        spinMove         = false;
        wallDetectRadius = 0.19f;
        counter          = 0;
        jumpMove         = false;
        originalPos      = transform.position.x;
        hurtBySpin       = true;
        flip(); //As player enters the room on the left hand side, so flip the boss first to face to player
    }
    public override void Init()
    {
        WorldObjectType = Define.WorldObject.Player;
        _stat           = gameObject.GetComponent <PlayerStat>();

        Managers.Input.MouseAction -= OnMouseEvent;
        Managers.Input.MouseAction += OnMouseEvent;

        if (gameObject.GetComponentInChildren <UI_HPBar>() == null)
        {
            Managers.UI.MakeWorldSpaceUI <UI_HPBar>(transform);
        }

        redEffect.SetActive(false);
        blueEffect.SetActive(false);
        greenEffect.SetActive(false);
    }
Example #28
0
    protected override void Init()
    {
        WorldObjectType = Define.WorldObject.Player;
        _stat           = gameObject.GetComponent <PlayerStat>();

        // 구독신청. InputManager한테 혹시 무슨 키가 눌리면 이 함수를 실행해주세요 라고 맡기게 된다.
        // 혹시 실수로 다른부분에서 OnKeyboard를 두번 집어넣으면 두번호출되게 되므로 처음에 끊은 다음에 다시 추가
        //Managers.Input.KeyAction -= OnKeyboard;
        //Managers.Input.KeyAction += OnKeyboard;
        Managers.Input.MouseAction -= OnMouseEvent;
        Managers.Input.MouseAction += OnMouseEvent;

        if (gameObject.GetComponentInChildren <UI_HPBar>() == null)
        {
            Managers.UI.MakeWorldSpaceUI <UI_HPBar>(transform);
        }
    }
Example #29
0
    public override void Init()
    {
        WorldObjectType = Define.WorldObject.Player;
        //Input Manager 구독

        _stat = gameObject.GetComponent <PlayerStat>();
        Managers.Input.MouseAction -= OnMouseEvent; //다른 곳에서 구독하고 있는 경우를 방지하기 위해 우선 -- 후 +
        Managers.Input.MouseAction += OnMouseEvent;

        Managers.UI.MakeWorldSpaceUI <UI_HPBar>(transform);

        /*
         * 키보드의 경우..
         * Managers.Input.KeyAction -= OnKeyboard;
         * Managers.Input.KeyAction += OnKeyboard;
         */
    }
Example #30
0
    private void OnPlayerStatChanged(PlayerStat stat, int oldValue, int newValue)
    {
        if (isGameOver)
        {
            // Don't update, the game is already ending, could lead to wrong ending
            return;
        }

        if (newValue >= 10)
        {
            gameController.globalFadeController.StartFadeOut(2f);
            gameController.globalFadeController.FadeOutComplete += OnFadeOutComplete;

            gameEndingStat = stat;
            isGameOver     = true;
        }
    }
Example #31
0
 public void changePos(PlayerStat stat)
 {
     if (moving)
     {
         return;
     }
     if (curr == 0)
     {
         curr = 1;
     }
     else
     {
         curr = 0;
     }
     moving    = true;
     this.stat = stat;
 }
    public override void Load(SimpleJSON.JSONObject json_data)
    {
        MASTER_MUSIC_VOL = json_data["MASTER_MUSIC_VOL"].AsFloat;
        MASTER_SFX_VOL   = json_data["MASTER_SFX_VOL"].AsFloat;

        DAY_NUMBER             = json_data["DAY_NUMBER"].AsInt;
        WORLD_ROOMS_DISCOVERED = (ROOM)json_data["WORLD_ROOMS_DISCOVERED"].AsInt;
        pinsDiscoveredValue    = json_data["pinsDiscoveredValue"].AsLong;
        pinsEquippedValue      = json_data["pinsEquippedValue"].AsLong;
        pinsViewedValue        = json_data["pinsViewedValue"].AsLong;


        EquippedAbilityPins[0] = (PIN)json_data["ABILITY_PIN_1"].AsLong;
        EquippedAbilityPins[1] = (PIN)json_data["ABILITY_PIN_2"].AsLong;

        STANDARD_GARBAGE_DISCOVERED   = (STANDARDGARBAGE)json_data["STANDARD_GARBAGE_DISCOVERED"].AsInt;
        STANDARD_GARBAGE_VIEWED       = (STANDARDGARBAGE)json_data["STANDARD_GARBAGE_VIEWED"].AsInt;
        COMPOST_GARBAGE_DISCOVERED    = (COMPOSTGARBAGE)json_data["COMPOST_GARBAGE_DISCOVERED"].AsInt;
        COMPOST_GARBAGE_VIEWED        = (COMPOSTGARBAGE)json_data["COMPOST_GARBAGE_VIEWED"].AsInt;
        RECYCLABLE_GARBAGE_DISCOVERED = (RECYCLABLEGARBAGE)json_data["RECYCLABLE_GARBAGE_DISCOVERED"].AsInt;
        RECYCLABLE_GARBAGE_VIEWED     = (RECYCLABLEGARBAGE)json_data["RECYCLABLE_GARBAGE_VIEWED"].AsInt;
        LARGE_GARBAGE_DISCOVERED      = (LARGEGARBAGE)json_data["LARGE_GARBAGE_DISCOVERED"].AsInt;
        LARGE_GARBAGE_VIEWED          = (LARGEGARBAGE)json_data["LARGE_GARBAGE_VIEWED"].AsInt;

        STAR_POINTS_STAT = new PlayerStat(PLAYERSTATTYPE.STAR_POINTS, json_data["STAR_POINTS"].AsInt);
        STAR_POINTS_STAT.SetCurrent(json_data["CURRENT_STAR_POINTS"].AsInt);

        HP_STAT = new PlayerStat(PLAYERSTATTYPE.HP, json_data["Max_HP"].AsInt);
        HP_STAT.ResetCurrent();

        BAG_SIZE_STAT = new PlayerStat(PLAYERSTATTYPE.BAG_SIZE, json_data["BAG_SIZE"].AsInt);
        HP_STAT.ResetCurrent();

        PP_STAT = new PlayerStat(PLAYERSTATTYPE.PP, json_data["PPVALUE"].AsInt);

        DEJAVUCOUNT             = json_data["DEJAVUCOUNT"].AsInt;
        CURSEVALUE              = json_data["CURSEVALUE"].AsInt;
        MOMONEYVALUE            = json_data["MOMONEYVALUE"].AsInt;
        PROGRESS_LV             = json_data["PROGRESS_LV"].AsInt;
        UPGRADES_UNLOCKED       = (UPGRADES)json_data["UPGRADES"].AsInt;
        TOTAL_DAYTIME_INSECONDS = json_data["TOTAL_DAYTIME_INSECONDS"].AsInt;
        TIME_UPGRADE_LEVEL      = json_data["TIME_UPGRADE_LEVEL"].AsInt;
        TUT_POPUPS_SHOWN        = (TUTORIALPOPUPS)json_data["TUT_POPUPS_SHOWN"].AsInt;
        BROKEN_TRASH_DOORS      = (TRASHDOORS)json_data["BROKEN_TRASH_DOORS"].AsInt;    //Steve did I do this right?
    }
Example #33
0
    public void AddToStat(PlayerStat stat, int value)
    {
        if (value == 0)
        {
            return;
        }

        switch (stat)
        {
        case (PlayerStat.Debt):
        {
            Debt = GetClampedValue(Debt + value);
            break;
        }

        case (PlayerStat.Depression):
        {
            Depression = GetClampedValue(Depression + value);
            break;
        }

        case (PlayerStat.Disease):
        {
            Disease = GetClampedValue(Disease + value);
            break;
        }

        case (PlayerStat.Distress):
        {
            Distress = GetClampedValue(Distress + value);
            break;
        }

        case (PlayerStat.Decay):
        {
            Decay = GetClampedValue(Decay + value);
            break;
        }

        default:
        {
            break;
        }
        }
    }
Example #34
0
    void Start()
    {
        Animationmanager = GetComponent <AnimationManager>();
        image            = GetComponentInChildren <Image>();
        levelText        = GetComponentInChildren <Text>();
        spriteRenderer   = GetComponent <SpriteRenderer>();
        rigidBody        = GetComponent <Rigidbody2D>();


        playerStat = GameObject.FindWithTag("GameController").GetComponent <PlayerStat>();


        health           = maxHealth;
        currentSpeed     = baseSpeed;
        image.fillAmount = health;
        level            = Random.Range(1, 11);
        levelText.text   = level.ToString();
    }
Example #35
0
 public void OnGameEvent(LevelEvent levelEvent)
 {
     if (levelEvent.GetLevelIndex() == 0)
     {
         return;
     }
     if (levelEvent.IsEntered())
     {
         m_Player       = GameObject.FindGameObjectWithTag("Player");
         m_PlayerStat   = (PlayerStat)SaveManagerProxy.Get().GetSavedObject(typeof(PlayerStat), m_PlayerStatSavePath);
         m_PlayerHealth = m_Player.GetComponent <Health>();
         m_PlayerHealth.SetMaxHealth(m_PlayerStat.m_HP);
     }
     else
     {
         SaveStat();
     }
 }
    public void AssignTeam(PlayerStat pStat, int team)
    {
        RemovePlayerFromAllTeams(pStat);

        if (team == 1)
        {
            team1.Add(pStat);
        }
        else if (team == 2)
        {
            team2.Add(pStat);
        }

        team1Num.text = team1.Count.ToString();
        team2Num.text = team2.Count.ToString();

        pStat.Team = team;
        pStat.SetPlayerColor(team == 1 ? gamePreferences.team1Colors[Random.Range(0, gamePreferences.team1Colors.Count)] : gamePreferences.team2Colors[Random.Range(0, gamePreferences.team2Colors.Count)]);
    }
    public void leaveConsole()
    {
        Vector3 new_r = new Vector3(0, 0, 0);

        stat.getCamPlayer().transform.localRotation = Quaternion.Euler(new_r);
        stat.getCamPlayer().transform.localPosition = new Vector3(0, 0.686F, 0);
        stat.getCamPlayer().GetComponent <MouseLook>().enabled = true;
        answer.text = "";
        save.transform.localRotation = Quaternion.Euler(new_r);
        stat.rotateCam(new_r);
        stat.setOnInteract(false);
        move.enabled = true;
        move         = null;
        stat         = null;
        save         = null;
        screenOn.SetActive(false);
        Cursor.visible   = false;
        Cursor.lockState = CursorLockMode.Locked;
    }
Example #38
0
 public static Offset <PlayerStat> CreatePlayerStat(FlatBufferBuilder builder,
                                                    Class cType = Class.Base,
                                                    int HP      = 0,
                                                    int HPLim   = 0,
                                                    int MP      = 0,
                                                    int MPLim   = 0,
                                                    int LV      = 0,
                                                    int ID      = 0)
 {
     builder.StartObject(7);
     PlayerStat.AddID(builder, ID);
     PlayerStat.AddLV(builder, LV);
     PlayerStat.AddMPLim(builder, MPLim);
     PlayerStat.AddMP(builder, MP);
     PlayerStat.AddHPLim(builder, HPLim);
     PlayerStat.AddHP(builder, HP);
     PlayerStat.AddCType(builder, cType);
     return(PlayerStat.EndPlayerStat(builder));
 }
    void Start()
    {
        plStat = GetComponent <PlayerStat>();
        plStat.Setup();

        rigidbody2D = GetComponent <Rigidbody2D>();

        SetupControls();

        walkSpeed   = (float)(plStat.Speed + (plStat.Agility / 5));
        sprintSpeed = walkSpeed + (walkSpeed / 2);

        SetPlayerState(PlayerState.Idle);

        Physics2D.IgnoreLayerCollision(9, 8);

        throwMeterBG.enabled   = false;
        throwMeterFill.enabled = false;
    }
    public bool CanSummon(PlayerStat stat)
    {
        int available = GetNumSummonable(stat.flockGroup);

        int numSummonable = available > data.summonAmount ? data.summonAmount : available;

        if(numSummonable > 0) {
            float cost = data.resource*((float)numSummonable);

            //adjust cost and summon amount if too expensive
            if(cost > stat.curResource) {
                return Mathf.FloorToInt(stat.curResource/data.resource) > 0;
            }
            else {
                return true;
            }
        }

        return false;
    }
Example #41
0
 public Task SetStat(PlayerStat stat)
 {
     throw new NotImplementedException();
 }
Example #42
0
    private void Start()
    {
        _colorToLerp = LightSource.LightColor;
        _lastSpawnUnits = 0;
        _spawnsCounter = 3;
        isStatsSended = false;
        _wasErrorNetwork = false;
        _playerStat = GetComponent<PlayerStat>();
        _lightLogic = Light.GetComponent<LightLogic>();
        _darkSpawn = 0;

        ProgressBar.SetActive(true);
        WinText.gameObject.SetActive(false);
        _shadowSource = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren<BeatLightScaler>();
        AudioSource.PlayClipAtPoint(NewStart, transform.position);
    }
    public void Update(PlayerStat stat, HUDUnitSlot hudSlot)
    {
        if(curTime < data.summonCooldown) {
            curTime += Time.deltaTime;

            hudSlot.UpdateCooldown(1.0f-cooldownScale);

            hudSlot.SetAvailable(false);
        }
        else {
            hudSlot.SetAvailable(CanSummon(stat));
        }
    }
Example #44
0
 void OnLevelPointsChange(PlayerStat stat, float delta)
 {
     lvlBar.sliderValue = stat.curLevelPts/stat.maxLevelPts;
 }
Example #45
0
 void OnLevelChange(PlayerStat stat, int level)
 {
     levelLabel.text = string.Format(levelTextFormat, level+1);
 }
Example #46
0
 void OnLevelPointsChange(PlayerStat stat, float delta)
 {
     if(stat.curLevelPts >= stat.maxLevelPts) {
         //Debug.Log("level up!");
         SceneWorld sw = SceneWorld.instance;
         sw.curLevel++;
     }
     else if(delta < 0) {
         Blink(hurtDelay);
     }
 }
Example #47
0
 private void Start()
 {
     _pStat = Camera.main.GetComponent<PlayerStat>();
 }
Example #48
0
 public Task SetStat(PlayerStat stat)
 {
     this.stat = stat;
     return TaskDone.Done;
 }