Example #1
0
 private void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
     }
 }
    public override void destroy()
    {
        // temp fix... TODO
        _gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();

        // add score to game manager
        _gameManager.addScore(score);

        // show score popup text
        PopupTextManager popupManager = GameObject.FindWithTag("PopupTextManager").GetComponent <PopupTextManager>();

        if (popupManager)
        {
            popupManager.showMessage(score.ToString(), transform.position);
        }
        else
        {
            Debug.LogError("Can't find the PopupTextManager.");
        }

        // fire weapon on destroy
        if (weaponOnDestroy)
        {
            weaponOnDestroy.fire();
        }

        // explosion, destroy gameobject
        base.destroy();
    }
    public void addWeaponExp(int exp)
    {
        // weapon is not max
        if (!_currentWeapon.isMaxLevel())
        {
            // add exp to current weapon
            bool isUpgraded = _currentWeapon.addExperience(exp);

            // update UI
            if (isUpgraded)
            {
                weaponCircle.switchWeapon(_currentWeapon);

                // Show popup text
                PopupTextManager popupManager = GameObject.FindWithTag("PopupTextManager").GetComponent <PopupTextManager>();
                if (popupManager)
                {
                    popupManager.showMessage("LEVEL UP", transform.position);
                }
            }
            else
            {
                weaponCircle.update(_currentWeapon);
            }
        }
        else
        {
            // exceeding exp would transfer to health
            applyHealing((int)(exp * rateExpToHp));
        }
    }
Example #4
0
 //Used to transition to Hall
 private PopupTextManager.OnClose TransitionToHall()
 {
     GameManager.Instance.introduceTrueGolem = true;
     GameManager.Instance.typeOfTrueGolem    = gemType;
     PopupTextManager.ResetEvents();
     Initiate.Fade("Hall", Color.black, 2.0f);
     return(() => { PopupTextManager.onClose -= TransitionToHall(); });
 }
    private void Display(NarrativeElement element)
    {
        Debug.Log("Displaying relevant narrative element");
        PopupTextManager clone = Instantiate(GizmoPrefab, GameObject.FindGameObjectWithTag("MainCamera").transform).GetComponentInChildren <PopupTextManager>();

        clone.PopupTexts = element.Texts;
        clone.Init();
        clone.DoEnterAnimation();
    }
    //Finish the sequence and reset relevant variables
    private void FinishSequence()
    {
        GameManager.Instance.introduceTrueGolem = false;
        GameManager.Instance.canUseTools        = true;
        inspectingGolem = true;

        hallFunctionality.MoveCameraBackButton.SetActive(true);
        PopupTextManager.ResetEvents();
    }
Example #7
0
    public override void doPowerup(PlayerController player)
    {
        player.addLife(life);

        // show popup text
        PopupTextManager popupManager = GameObject.FindWithTag("PopupTextManager").GetComponent <PopupTextManager>();

        if (popupManager)
        {
            popupManager.showMessage("+" + life + " LIFE", player.transform.position);
        }
        else
        {
            Debug.LogError("Can't find the PopupTextManager.");
        }
    }
    private void die()
    {
        // explosion vfx
        Instantiate(vfxExplosion, transform.position, transform.rotation);

        // Sfx
        if (Clip_OnDestroy)
        {
            Audio.PlaySfx(Clip_OnDestroy);
        }

        // drop experience as penalty
        if (!_currentWeapon.isMaxLevel())
        {
            int expDrop = _currentWeapon.experience;
            _currentWeapon.experience = 0;
            expDrop = (int)(expDrop * proportionExpDrop);
            weaponCircle.update(_currentWeapon);

            if (GameMgr == null)
            {
                Debug.LogError("Can't find the GameManager.");
            }
            else
            {
                Vector3 pos    = transform.position;
                float   radius = GetComponent <Collider>().bounds.extents.x + extendRangeExpDrop;
                GameMgr.dropExperience(pos, radius, expDrop);
            }

            // Show popup text for experience dropped
            PopupTextManager popupManager = GameObject.FindWithTag("PopupTextManager").GetComponent <PopupTextManager>();
            if (popupManager)
            {
                popupManager.showMessage("LOSE " + (proportionExpDrop * 100).ToString() + "% EXP", transform.position);
            }
            else
            {
                Debug.LogError("Can't find the PopupTextManager.");
            }
        }

        // turn off renderer and collider
        setVisible(false);
        GetComponent <Collider>().enabled = false;
        transform.position = new Vector3(0.0f, 10.0f, 0.0f); // place outside
    }
Example #9
0
    public override void doPowerup(PlayerController player)
    {
        // heal the player
        player.applyHealing(healing);

        // show popup text
        PopupTextManager popupManager = GameObject.FindWithTag("PopupTextManager").GetComponent <PopupTextManager>();

        if (popupManager)
        {
            popupManager.showMessage("+" + healing + " HP", player.transform.position);
        }
        else
        {
            Debug.LogError("Can't find the PopupTextManager.");
        }
    }
    public override void doPowerup(PlayerController player)
    {
        // add experience to player
        player.addWeaponExp(experience);

        // show popup text
        PopupTextManager popupManager = GameObject.FindWithTag("PopupTextManager").GetComponent <PopupTextManager>();

        if (popupManager)
        {
            popupManager.showMessage("+" + experience + " EXP", player.transform.position);
        }
        else
        {
            Debug.LogError("Can't find the PopupTextManager.");
        }
    }
Example #11
0
        /// <summary>
        /// Start is called before the first frame update
        /// </summary>
        void Start()
        {
            popupDamageManager = new PopupTextManager(CanvasGameObject);

            // プレハブから Player を生成
            var playerPrefab = (GameObject)Resources.Load("Prefabs/Player/BattlePlayer");

            battlePlayer = Instantiate(playerPrefab, Vector3.zero, Quaternion.identity);
            battlePlayer.SetActive(false);
            var enemyPrefab = (GameObject)Resources.Load("Prefabs/Enemy/BattleEnemy");

            battleEnemy = Instantiate(enemyPrefab, Vector3.zero, Quaternion.identity);
            battleEnemy.SetActive(false);

            FadeManager.Blackout();
            FadeManager.FadeIn();

            stateMachine = new IceMilkTea.Core.ImtStateMachine <BattleScene>(this);
            stateMachine.AddTransition <WaitState, BattleState>((int)StateEventId.Start);
            stateMachine.AddTransition <BattleState, TurnChangeState>((int)StateEventId.TurnChange);
            stateMachine.AddTransition <TurnChangeState, BattleState>((int)StateEventId.Battle);
            stateMachine.AddTransition <TurnChangeState, WinState>((int)StateEventId.Win);
            stateMachine.AddTransition <TurnChangeState, LoseState>((int)StateEventId.Lose);
            stateMachine.AddTransition <WinState, LeaveState>((int)StateEventId.Leave);

            stateMachine.SetStartState <WaitState>();

            var playerBattlerScript = battlePlayer.GetComponent <Battler>();
            var enemyBattlerScript  = battleEnemy.GetComponent <Battler>();

            var param = (BattleSceneParam)SceneParam;

            playerBattlerScript.Status = param.PlayerStatus;
            enemyBattlerScript.Status  = Database.EnemyDatabase.GetStatus(param.EncountId);

            turnTypes = TurnTypes.Player;
        }
    //Makes dialogue reappear when clicking on an inspected golem
    public void ReshowDialogue()
    {
        readingDialogue = true;
        List <string> selectedDialogue;

        switch (golemSelected.name)
        {
        case "TrueRubyGolem":
            selectedDialogue = rubyGolemDialogue;
            break;

        case "TrueAmethystGolem":
            selectedDialogue = amethystGolemDialogue;
            break;

        case "TrueSapphireGolem":
            selectedDialogue = sapphireGolemDialogue;
            break;

        case "TrueEmGolemv1":
            selectedDialogue = emeraldGolemDialogue;
            break;

        default:
            selectedDialogue = rubyGolemDialogue;
            break;
        }

        PopupTextManager clone = Instantiate(gizmoPrefab, GameObject.FindGameObjectWithTag("MainCamera").transform).GetComponentInChildren <PopupTextManager>();

        clone.PopupTexts = selectedDialogue;
        clone.Init();
        clone.DoEnterAnimation();

        hallFunctionality.MoveCameraBackButton.SetActive(false);
        PopupTextManager.onClose += () => ReenableButton();
    }
 private void ReenableButton()
 {
     hallFunctionality.MoveCameraBackButton.SetActive(true);
     readingDialogue = false;
     PopupTextManager.ResetEvents();
 }