Ejemplo n.º 1
0
    public void Setup(PlayerStatManager playerStatManager)
    {
        HealthMax = 100 * (playerStatManager.Get("HEALTH_MAX_PERCENT") / 100f + 1f);
        Health    = HealthMax;

        WealthGenerationPercentBonus = playerStatManager.Get("WEALTH_GENERATION_PERCENT") / 100f + 1f;
    }
Ejemplo n.º 2
0
 void Start()
 {
     theNotice  = FindObjectOfType <NoticeManager>();
     theOddEven = FindObjectOfType <OddEvenGame>();
     theStat    = FindObjectOfType <PlayerStatManager>();
     InitMoneyChange();
 }
Ejemplo n.º 3
0
    void Start()
    {
        PSM = PlayerStatManager.Instance;
        GetSaves.Instance.SaveAll += Save;
        if (PlayerPrefs.HasKey("SoldierUpgradeHealthCost") || PlayerPrefs.HasKey("SoldierUpgradeDamageCost"))
        {
            Load();
        }
        else
        {
            UpgradeHealthText.text = "Gems: " + UpgradeHealthCost;
            UpgradeDamageText.text = "Gems: " + UpgradeDamageCost;

            if (UType == UpgradeType.Mage)
            {
                UpgradeMageSpawnRateText.text = "Gems: " + UpgradeMageSpawnRateCost;
                UpgradeMageAoeRangeText.text  = "Gems: " + UpgradeMageAoeRangeCost;
                UpgradeSpeedText.text         = "Gems: " + UpgradeSpeedCost;
            }
            else if (UType == UpgradeType.Soldier)
            {
                UpgradeSpawnRateText.text = "Gems: " + UpgradeSpawnRateCost;
                UpgradeSpeedText.text     = "Gems: " + UpgradeSpeedCost;
            }
            else if (UType == UpgradeType.Ninja)
            {
                UpgradeNinjaSpawnRateText.text = "Gems: " + UpgradeNinjaSpawnRateCost;
            }
        }
    }
Ejemplo n.º 4
0
    IEnumerator Pickup(Collider player)
    {
        //Debug.Log("Power up picked up!");
        //Particle
        GameObject     explosion = Instantiate(pickupEffect, transform.position, transform.rotation, parentObject) as GameObject;
        ParticleSystem parts     = explosion.GetComponent <ParticleSystem>();

        Destroy(explosion, parts.main.duration);

        //Effect
        PlayerStatManager playerstat = player.GetComponent <PlayerStatManager>();

        playerstat.currentHealth *= multiplier;

        GetComponent <MeshRenderer>().enabled = false;
        GetComponent <Collider>().enabled     = false;

        yield return(new WaitForSeconds(duration));

        playerstat.currentHealth /= multiplier;

        player.transform.localScale *= multiplier;

        //Destroy pickup
        Destroy(gameObject);
    }
    public void GoToHorizon(Transform player)
    {
        SoundManager.instance.LoadSound("chock1", 0.7f, 1.0f);
        stopCurrentAction = true;

        PlayerTriggerManager playerTriggerManager = player.GetComponent <PlayerTriggerManager>();
        PlayerStatManager    playerStatManager    = player.GetComponent <PlayerStatManager>();

        if (playerTriggerManager.canColide)
        {
            ennemyHealth -= playerStatManager.damage;
        }
        else
        {
            ennemyHealth -= playerStatManager.damage * 2;
        }

        EnnemyBar.Play("EnnemyLife", 0, ennemyHealth / 100.0f);
        EnnemyBar.speed  = 0.0f;
        activeDecelerate = false;
        StartCoroutine(ChangePositionAt(0.9f, 1.0f));

        if (!playerTriggerManager.isInvinsible)
        {
            delegateHandler.OnDamage(40);
        }
    }
Ejemplo n.º 6
0
    // Use this for initialization
    void Awake()
    {
        _gameManager = GameObject.FindGameObjectWithTag("GameManager");
        PlayerStatManager g = null;

        if (_gameManager != null)
        {
            g = _gameManager.GetComponent <PlayerStatManager>();
        }
        NumberOfPlayers = g.numberOfPlayers;
        SpawnPoints     = GameObject.FindGameObjectsWithTag("Respawn");
        for (int i = 0; i < NumberOfPlayers; i++)
        {
            var s = Random.Range(0, SpawnPoints.Length);
            while (s == oldSpawn)
            {
                s = Random.Range(0, SpawnPoints.Length);
            }
            Players[i]        = Instantiate(PlayerPrefab, SpawnPoints[s].transform.position, Quaternion.identity) as GameObject;
            oldSpawn          = s;
            PlayersScripts[i] = Players[i].GetComponent <Player>();
            if (i == 0)
            {
                PlayersScripts[i].isPlayerOne = true;
            }

            var p = PlayersScripts[i];
            p.Lives  = g.Lives[i];
            p.Deaths = g.Deaths[i];
            p.Kills  = g.Kills[i];
        }
    }
Ejemplo n.º 7
0
 //나의 주식함수를 불러서 내가 소유중인 주식 스크립트 배열을 사용한다
 //기본적인 초기화 실시
 void Start()
 {
     mystockOnOff             = FindObjectOfType <MyStock>();
     sellStockCountPanel.text = "0";
     buyStockCountPanel.text  = "0";
     theStat = FindObjectOfType <PlayerStatManager>();
 }
Ejemplo n.º 8
0
    void Awake()
    {
        // singleton enforcement
        // if (FindObjectsOfType(typeof(PlayerStatManager)).Length > 1)
        // {
        //     Debug.Log("PSM: Already found instance of script in scene; destroying.");

        //         DestroyImmediate(gameObject);
        // }

        if (_instance != null && _instance != this)
        {
            GameObject.Destroy(this.gameObject);
        }
        else
        {
            _instance = this;

            playerStats = new PlayerStatistics[4];

            for (int i = 0; i < 4; i++)
            {
                playerStats[i] = new PlayerStatistics(5, 5, 3f, 4f, 3);
            }
            DontDestroyOnLoad(gameObject);
        }
    }
Ejemplo n.º 9
0
    public void Setup(PlayerStatManager playerStatManager)
    {
        PlayerStatManager = playerStatManager;

        RunSpeedPercentBonus = PlayerStatManager.Get("RUN_SPEED_PERCENT") / 100f + 1f;

        PlayerStatusController.Setup(PlayerStatManager);
    }
Ejemplo n.º 10
0
 void Start()
 {
     theDate         = FindObjectOfType <DateManager>();
     theStat         = FindObjectOfType <PlayerStatManager>();
     theStockManager = FindObjectOfType <StockManager>();
     M = Random.Range(1, 2);
     D = Random.Range(1, 2);
 }
Ejemplo n.º 11
0
 private void OnTriggerEnter2D(Collider2D col)
 {
     if (col.tag == "PLAYER")
     {
         statManager = col.GetComponent <PlayerStatManager>();
         ItemSlotManager.GetInstance().AttachItemInSlot(this);
         gameObject.SetActive(false);
     }
 }
Ejemplo n.º 12
0
 //Loads the player stats
 public void LoadStats(ref PlayerStatManager stats)
 {
     stats.Speed   = PlayerPrefs.GetFloat("SPEED", stats.BaseSpeed);
     stats.Jump    = PlayerPrefs.GetFloat("JUMP", stats.BaseJump);
     stats.Shoot   = PlayerPrefs.GetFloat("SHOOT", stats.BaseShoot);
     stats.Defense = PlayerPrefs.GetFloat("DEFENSE", stats.BaseDefense);
     stats.Dribble = PlayerPrefs.GetFloat("DRIBBLE", stats.BaseDribble);
     stats.Money   = PlayerPrefs.GetFloat("MONEY", 0);
 }
Ejemplo n.º 13
0
 //Saves the player stats
 public void SaveStats(PlayerStatManager stats)
 {
     PlayerPrefs.SetFloat("SPEED", stats.Speed);
     PlayerPrefs.SetFloat("JUMP", stats.Jump);
     PlayerPrefs.SetFloat("SHOOT", stats.Shoot);
     PlayerPrefs.SetFloat("DEFENSE", stats.Defense);
     PlayerPrefs.SetFloat("DRIBBLE", stats.Dribble);
     PlayerPrefs.SetFloat("MONEY", stats.Money);
 }
Ejemplo n.º 14
0
    // Use this for initialization
    void Start()
    {
        gazTank = GetComponent <Image>();
        StartCoroutine(UpdateGazTank());

        if (IsPlayer)
        {
            playerStatManager = GameObject.Find("Player").GetComponent <PlayerStatManager>();
        }
    }
Ejemplo n.º 15
0
 // Start is called before the first frame update
 void Start()
 {
     theStat          = FindObjectOfType <PlayerStatManager>();
     theSellBuy       = FindObjectOfType <StockManager>();
     theNotice        = FindObjectOfType <NoticeManager>();
     theHandler       = FindObjectOfType <LandmarksHandler>();
     theDate          = FindObjectOfType <DateManager>();
     StockInOut       = true;
     stockInOutT.text = "기업입주";
 }
Ejemplo n.º 16
0
    public void Setup(PlayerStatManager playerStatManager, PlayerStatusController playerStatusController)
    {
        PlayerStatusController = playerStatusController;
        PlayerStatManager      = playerStatManager;

        HealthBar.rectTransform.sizeDelta = new Vector2(PlayerStatusController.HealthMax, HealthBar.rectTransform.sizeDelta.y);
        EnergyBar.rectTransform.sizeDelta = new Vector2(PlayerStatusController.EnergyMax, EnergyBar.rectTransform.sizeDelta.y);

        UpdateStatusText();
    }
Ejemplo n.º 17
0
    void OnTriggerEnter(Collider collider)
    {
        PlayerStatManager enemyPlayer = collider.GetComponent <PlayerStatManager>();

        if (enemyPlayer != null && collider != instantiator.GetComponent <Collider>())
        {
            enemyPlayer.TakeDamage(damage);
        }
        Destroy(gameObject);    //destroys bullet
    }
Ejemplo n.º 18
0
    private void Awake()
    {
        if (Instance != null)
        {
            Debug.Log("[PlayerStatManager] There is more then one Instance");
            return;
        }
        Instance = this;

        LoadResources();
    }
Ejemplo n.º 19
0
    // Start is called before the first frame update
    void Start()
    {
        anim       = GetComponent <Animator>();
        playerStat = GetComponent <PlayerStatManager>();
        rb         = GetComponent <Rigidbody>();

        walkSpeed      = playerStat.p_DefaultWalkSpeed;
        sprintSpeed    = playerStat.p_DefaultRunSpeed;
        jumpForce      = playerStat.p_DefaultJumForce;
        fallMultiplier = playerStat.p_DefaultFallMultiplier;
    }
Ejemplo n.º 20
0
 // Start is called before the first frame update
 void Awake()
 {
     anim           = GetComponent <Animator>();
     rb             = GetComponent <Rigidbody>();
     rb.constraints = RigidbodyConstraints.FreezeRotation;
     playerStat     = GetComponent <PlayerStatManager>();
     walkSpeed      = playerStat.p_DefaultWalkSpeed;
     sprintSpeed    = playerStat.p_DefaultRunSpeed;
     jumpForce      = playerStat.p_DefaultJumForce;
     fallMultiplier = playerStat.p_DefaultFallMultiplier;
 }
Ejemplo n.º 21
0
 // Use this for initialization
 void Start()
 {
     rb                   = GetComponent <Rigidbody2D>();
     Movement             = GetComponent <RigidbodyMovement2D>();
     spriteRenderer       = GetComponent <SpriteRenderer>();
     playerScale          = transform.localScale;
     possessionTimer      = possessionTimerOriginal;
     moveAfterLaunchTimer = moveAfterLaunchTime;
     statManager          = statObject.GetComponent <PlayerStatManager>();
     henryAnim            = GetComponent <Animator>();
 }
Ejemplo n.º 22
0
    void Start()
    {
        TransitionManager.FadeIn(1f, Color.black);

        var playerStatManager = new PlayerStatManager();

        GameObjectM.GetComponentOnObject <PlayerController>("Player").Setup(playerStatManager);

        var PlayerStatusController = GameObjectM.GetComponentOnObject <PlayerStatusController>("Player");

        GameObjectM.GetComponentOnObject <GuiPanelController>("GuiPanel").Setup(playerStatManager, PlayerStatusController);
    }
Ejemplo n.º 23
0
    // Use this for initialization
    void Start()
    {
        IsDamage = false;

        if (GameObject.Find("Player") != null)
        {
            playerStat = GameObject.Find("Player").GetComponent <PlayerStatManager>();
        }

        if (GameObject.Find("Score") != null)
        {
            Score = GameObject.Find("Score").GetComponent <Text>();
        }

        StartCoroutine(UpdatePosition());
    }
Ejemplo n.º 24
0
    // Use this for initialization
    void Start()
    {
#if UNITY_WEBGL || UNITY_STANDALONE
        tutoInputLeft.SetActive(true);
        tutoInputRight.SetActive(true);
#endif

        canSwap     = false;
        canUseInput = true;
        isTuto      = true;
        beginTouch  = Vector3.zero;
        endTouch    = Vector3.zero;
        playerStat  = GetComponent <PlayerStatManager>();
        GetComponent <Animator>().Play("PlayerPath3", 0, 0.0f);
        StartCoroutine(InputUpdate());
    }
Ejemplo n.º 25
0
    public void InitMoneyChange()
    {
        /*신용등급에 따른 입장료의 변화*/
        /*함수 호출시 선언 필요*/
        theStat = FindObjectOfType <PlayerStatManager>();

        if (theStat.playerCredit > 7)
        {
            inputMoney        = 1000;
            inputMoneyT1.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
            inputMoneyT2.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
            inputMoneyT3.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
            inputMoneyT4.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
        }
        else if (theStat.playerCredit > 5)
        {
            inputMoney        = 10000;
            inputMoneyT1.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
            inputMoneyT2.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
            inputMoneyT3.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
            inputMoneyT4.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
        }
        else if (theStat.playerCredit > 3)
        {
            inputMoney        = 50000;
            inputMoneyT1.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
            inputMoneyT2.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
            inputMoneyT3.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
            inputMoneyT4.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
        }
        else if (theStat.playerCredit > 1)
        {
            inputMoney        = 100000;
            inputMoneyT1.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
            inputMoneyT2.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
            inputMoneyT3.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
            inputMoneyT4.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
        }
        else if (theStat.playerCredit == 1)
        {
            inputMoney        = 1000000;
            inputMoneyT1.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
            inputMoneyT2.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
            inputMoneyT3.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
            inputMoneyT4.text = "비용 : $" + string.Format("{0}", inputMoney.ToString("n0"));
        }
    }
Ejemplo n.º 26
0
 //Should launch at the beginning of every scene
 public void ReloadScene()
 {
     if (GameObject.FindGameObjectWithTag("Player") != null)
     {
         Player      = GameObject.FindGameObjectWithTag("Player");
         PlayerStats = Player.GetComponent <PlayerStatManager>();
         if (NewGame)
         {
             PlayerStats.SetBase();
             _saveData.SaveStats(PlayerStats);
             NewGame = false;
         }
         else
         {
             _saveData.LoadStats(ref PlayerStats);
         }
     }
 }
Ejemplo n.º 27
0
    void Start()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }

        GetSaves.Instance.SaveAll += Save;
        if (PlayerPrefs.HasKey("Money"))
        {
            LoadPlayerStats();
        }
        //SetSoldiersStats();
    }
Ejemplo n.º 28
0
 private void OnEnable()
 {
     if (PSM == null)
     {
         PSM = PlayerStatManager.Instance;
     }
     if (WM == null)
     {
         WM = WaveManager.Instance;
     }
     if (FK != null)
     {
         TargetDied();
     }
     CanMove  = true;
     IsDead   = false;
     SetStats = true;
     FK       = null;
 }
Ejemplo n.º 29
0
    public void init()
    {
        goFalse.SetActive(false);
        activeFalse.SetActive(false);
        theMiniGame = FindObjectOfType <MiniGameOnOff>();
        theStat     = FindObjectOfType <PlayerStatManager>();
        theNotice   = FindObjectOfType <NoticeManager>();
        theMini     = FindObjectOfType <MiniGameOnOff>();
        theReport   = FindObjectOfType <StockReportManager>();

        /*그림 및 글 초기화*/
        resultItemT.text = "두구두구";
        Sprite newSprite = Resources.Load <Sprite>("mystery") as Sprite;

        resultImage.GetComponent <Image>().sprite = newSprite;

        //랜덤으로 나올 상품들
        result = new List <string>();
        string[] randomString = new string[8] {
            "하트", "꽝", "본전X5", "꽝", "본전X2", "하트", "꽝", "다시하기"
        };

        for (int i = 0; i < ItemCnt; i++)
        {
            /*리스트에 0~7의 숫자를 넣는다*/
            StartList.Add(i);
        }

        for (int i = 0; i < ItemCnt; i++)
        {
            /*랜덤 인덱스에 0~7의 숫자를 배정*/
            int randomIndex = Random.Range(0, StartList.Count);
            /*결과리스트에 스타트 리스트에 있는 숫자중 랜덤 인덱스의 위치에 있는 값을 넣는다*/
            ResultIndexList.Add(StartList[randomIndex]);
            /*보여줄 아이템슬롯 0~7번에 랜점으로 배정된 이미지를 넣는다*/
            displayItemSolt[i].sprite = itemImage[StartList[randomIndex]];
            result.Add(randomString[StartList[randomIndex]]);
            /*이미 넣은 인덱스는 제거한다, count => 8, 7, 6, ...*/
            StartList.RemoveAt(randomIndex);
        }
    }
Ejemplo n.º 30
0
    void Start()
    {
        playerStat = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStatManager>();

        switch (playerStat.NvOutRun)
        {
        case 1:
        {
            SoundManager.instance.LoadMusic("F1 Havas Run1", 0.6f);
            break;
        }

        case 2:
        {
            SoundManager.instance.LoadMusic("F1 Havas Run 2", 0.6f);
            break;
        }
        }

        float deltaTextureOffset = material.mainTextureOffset.y;

        roads.Add(RoadPart);

        Material tempMaterial = material;

        int     i;
        Vector3 scale = RoadPart.transform.localScale;

        for (i = 1; i < roadLenght; i++)
        {
            GameObject roadPart = Instantiate(RoadPart, RoadPart.transform.localPosition * i * deltaRoadScale, Quaternion.identity);
            roadPart.transform.localScale = new Vector3((scale.x /**0.9975f*/) - deltaRoadScale, scale.y, 1.0f);
            roadPart.GetComponent <UpdateRoadPart>().idRoad = i;
            roadPart.GetComponent <Renderer>().material     = tempMaterial;
            roadPart.GetComponent <Renderer>().material.mainTextureOffset = Vector2.up * i * deltaTextureOffset;
            scale = roadPart.transform.localScale;
            roadPart.transform.SetParent(transform);
            roadPart.GetComponent <UpdateRoadPart>().idRoad = i;
            roads.Add(roadPart);
        }
    }