Example #1
0
    public void DisplayMoneyFloatingText(float money, Vector3 position)
    {
        //Transform tr
        string moneyMessage = "+" + money.ToString() + " $";

        FloatingTextManager.CreateFloatingText(moneyMessage, position);
    }
    public void IncrementScore(int scoreChange, float xPos, float yPos)
    {
        Debug.Log("Score Changed");

        if (m_localPortrait)
        {
            m_localPortrait.IncrementScore(scoreChange);
        }
        else
        {
            m_portraits[0].IncrementScore(scoreChange);
        }

        Transform tempPos = this.transform;

        tempPos.position = new Vector3(xPos, yPos, -3.5f);

        if (scoreChange > 0)
        {
            FloatingTextManager.CreateFloatingText("+" + scoreChange, tempPos, Color.green);
        }
        else
        {
            FloatingTextManager.CreateFloatingText("" + scoreChange, tempPos, Color.red);
        }
    }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
    // Use this for initialization
    void Start()
    {
        SceneManager.SetActiveScene(SceneManager.GetSceneByBuildIndex(7));

        m_currState = GameState.Setup;

        m_hammers = new List <GameObject>();

        m_spawner = new float[SPAWNERS];

        for (int i = 0; i < SPAWNERS; i++)
        {
            m_spawner[i] = Random.Range(0.1f, maxSpawnTime);
        }

        FloatingTextManager.Initialise();


        m_playerIDObject = GameObject.FindGameObjectWithTag("Player");
        m_overworldGM    = GameObject.FindGameObjectWithTag("GameManager");

        //m_clientID = m_playerIDObject.GetComponent<CustomLobby>().playerDetails.Identifier;



        newCanvas = Instantiate(tutorialCanvas, new Vector3(0.0f, 0.0f, 0.0f), Quaternion.identity);

        m_background     = GameObject.FindGameObjectWithTag("Background");
        tutorialTimerTxt = GUIText.FindObjectOfType <Text>();


        m_gameTime = startTime;

        m_isOldTouch = false;
    }
    //start function
    void Start()
    {
        SceneManager.SetActiveScene(SceneManager.GetSceneByBuildIndex(5));
        //FadeOutAnimation = GameObject.Find("FadeOut").GetComponent<StopAnimationScript>();
        FadeInAnimation = GameObject.Find("FadeIn").GetComponent <StopAnimationScript> ();
        fade.SetActive(false);



        newCanvas       = Instantiate(tutorialCanvas, new Vector3(0.0f, 0.0f, 0.0f), Quaternion.identity);
        tutorialTimeTxt = GUIText.FindObjectOfType <Text>();

        //if the background music prefab isnt in the scene then it will not try and search for it
        if (GameObject.FindGameObjectWithTag("BGMusic") != null)
        {
            backgroundMusic = GameObject.FindGameObjectWithTag("BGMusic");
            m_musicFadeOut  = backgroundMusic.GetComponent <MusicFadeOut>();
        }
        //initialise timer
        m_gameTimer = (int)gameDuration;

        //floating text manager public static utility class initialisation
        FloatingTextManager.Initialise();

        //set up screen orientation and plant grid
        Screen.orientation = ScreenOrientation.Landscape;

        //get the component stuff from the portait prefabs
        //Player1Stats = Player1.GetComponent<PortaitScript> ();
        //Player2Stats = Player2.GetComponent<PortaitScript> ();
        //Player3Stats = Player3.GetComponent<PortaitScript> ();
        // Player4Stats = Player4.GetComponent<PortaitScript> ();
    }
Example #6
0
 // Start is called before the first frame update
 void Awake()
 {
     holdAttack = true;
     FindNewDirection();
     // alertLight.intensity = 0;
     movementTimer = GetRandomInRange(movementTimes);
     floatingText  = GameObject.Find("Floating Text Manager").GetComponent <FloatingTextManager>();
 }
Example #7
0
 private void Start()
 {
     textManager       = GetComponent <FloatingTextManager>();
     animator          = GetComponent <Animator>();
     animatorTime      = GetComponent <AnimationManager>().GetAnimationLength("Combat Dummy Hit");
     previousHealth    = health;
     previousTransform = transform.position;
 }
Example #8
0
    private void Start()
    {
        if (Colour != "" && Colour != null)
        {
            ColourEventManager.ColourEvents[Colour].OnActivated += PistonScript_OnActivated;
        }

        FTM = FindObjectOfType <FloatingTextManager>();
    }
Example #9
0
    private void Start()
    {
        if (Colour != "" && Colour != null)
        {
            ColourEventManager.ColourEvents[Colour].OnActivated += CannonScript_OnActivated;
        }

        LevelManager.LevelRestartEvent += LevelManager_LevelRestartEvent;
        FTM = FindObjectOfType <FloatingTextManager>();
    }
Example #10
0
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Example #11
0
 private void Awake()
 {
     if (Instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
     }
 }
Example #12
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Example #13
0
    // Start is called before the first frame update
    void Awake()
    {
        // Get first and last names
        firstNames = Resources.Load <TextAsset>("FirstNames").text.Split("\n"[0]);
        lastNames  = Resources.Load <TextAsset>("LastNames").text.Split("\n"[0]);

        string name = $"{firstNames[Random.Range(0, firstNames.Length)]} {lastNames[Random.Range(0, lastNames.Length)]}";

        floatingTextManager = GameObject.Find("Floating Text Manager").GetComponent <FloatingTextManager>();
        floatingTextManager.CreateFloatingText(player, $"{name}, reporting in!");
    }
 protected virtual void DoDisplayName(bool state)
 {
     if (state)
     {
         FloatingTextManager.Add(gameObject, gameObject.name.Replace("(Clone)", ""), this.m_Color, this.m_Offset);
     }
     else
     {
         FloatingTextManager.Remove(gameObject);
     }
 }
Example #15
0
    // Update is called once per frame
    void Update()
    {
        if (!m_isHit)
        {
            if (m_pieScript.GetLaunched() == true)
            {
                //cast a ray out of all the objects and store them in an array
                RaycastHit[] hit = Physics.RaycastAll(gameObject.transform.position, new Vector3(0.0f, 0.0f, 1.0f), Mathf.Infinity);


                for (int i = 0; i < hit.Length; i++)
                {
                    m_isHit = true;
                    m_pieScript.SetHit(m_isHit);
                    PedScript pedScript;

                    //get the ped script of the object that the pie has collided with
                    pedScript = hit[i].collider.gameObject.GetComponent <PedScript>();

                    //get the animator component to transition the animation states
                    Animator    pedAnimator = hit [i].collider.gameObject.GetComponent <Animator> ();
                    AudioSource pedSound    = hit[i].collider.gameObject.GetComponent <AudioSource>();


                    //play impact sounds
                    pedSound.Play();
                    m_pieSplatSound.Play();

                    pedAnimator.Play("Impact");
                    //stop the move speed to allow the animation to play
                    pedScript.SetMoveSpeed(0.0f);
                    //add a delay to the destruction of the enemy to allow for the animation to play
                    Destroy(hit [i].collider.gameObject, 1.0f);


                    //get the unique score of the collided object
                    m_hitScore = pedScript.GetScore();
                    //add the score to the player's score
                    m_gameManagerScript.AddScore(m_hitScore);
                    FloatingTextManager.CreateFloatingText(m_hitScore.ToString(), hit [i].collider.transform, Color.red);

                    //respawn the pie
                    m_pieScript.Respawn();
                    m_pieScript.Destroy();
                    //stop the velocity of the pie for animation purposes
                    m_pieScript.SetDistance(new Vector3(0.0f, 0.0f, 0.0f));
                    break;
                }
            }

            m_pieScript.SetHit(m_isHit);
        }
    }
Example #16
0
    // Start is called before the first frame update
    void Start()
    {
        FTM   = FindObjectOfType <FloatingTextManager>();
        Agent = GetComponent <NavMeshAgent>();

        RagdollActive  = false;
        FinishLocation = EnemyTarget.position;

        SetupRagdoll();

        // Make enemy move to specified location
        MoveToPosition(FinishLocation);
    }
Example #17
0
    public void Perform(GameObject target, CharacterData attackerData, FloatingTextManager floatingTxtMgr)
    {
        float healAmount = 3 * Formula.CalculateHealing(attackerData.healPower);

        // Apply dmg to target
        if (target.tag == "Player" || target.tag == "Enemy")
        {
            target.BroadcastMessage("ApplyHeal", healAmount);


            Vector3 textOffset = new Vector3(0, 30);
            floatingTxtMgr.CreateFloatingText(healAmount.ToString(), target.transform.position + textOffset, this.CategoryColor().fontColor, this.CategoryColor().outlineColor);
        }
    }
Example #18
0
 void Start()
 {
     Instance = this;
     ResourceManager.Instance.AllocateAndStore("Prefabs/Numbers/0", "Number0");
     ResourceManager.Instance.AllocateAndStore("Prefabs/Numbers/1", "Number1");
     ResourceManager.Instance.AllocateAndStore("Prefabs/Numbers/2", "Number2");
     ResourceManager.Instance.AllocateAndStore("Prefabs/Numbers/3", "Number3");
     ResourceManager.Instance.AllocateAndStore("Prefabs/Numbers/4", "Number4");
     ResourceManager.Instance.AllocateAndStore("Prefabs/Numbers/5", "Number5");
     ResourceManager.Instance.AllocateAndStore("Prefabs/Numbers/6", "Number6");
     ResourceManager.Instance.AllocateAndStore("Prefabs/Numbers/7", "Number7");
     ResourceManager.Instance.AllocateAndStore("Prefabs/Numbers/8", "Number8");
     ResourceManager.Instance.AllocateAndStore("Prefabs/Numbers/9", "Number9");
 }
Example #19
0
 private void AttachStateManagers()
 {
     StateMgr.AddGameState(currentPlayer);
     FloatingTextMgr = new FloatingTextManager(this);
     StateMgr.AddGameState(FloatingTextMgr);
     LevelEnv = new LevelEnvironment();
     StateMgr.AddGameState(LevelEnv);
     AlertMessageMgr = new AlertMessageManager(this, 0.5f);
     StateMgr.AddGameState(AlertMessageMgr);
     SpectatorActionMgr = new SpectatorActionsManager();
     StateMgr.AddGameState(SpectatorActionMgr);
     ScreenShakingMgr = new ScreenShakingManager(this);
     StateMgr.AddGameState(ScreenShakingMgr);
 }
Example #20
0
    // Perform this attack on a single target
    public void Perform(GameObject target, CharacterData attackerData, FloatingTextManager floatingTxtMgr)
    {
        float dmgAmount = Formula.CalculateDamage(attackerData.attackPower);

        // Apply dmg to target
        if (target.tag == "Player" || target.tag == "Enemy" || target.tag == "Trap" || target.tag == "Collectable")
        {
            target.BroadcastMessage("ApplyDamage", dmgAmount);

            Vector3 textOffset = new Vector3(0, 30);
            floatingTxtMgr.CreateFloatingText(dmgAmount.ToString(), target.transform.position + textOffset, Color.red, Color.yellow);
            DmgEffectManager.CreateHit(target.transform.position);
        }
    }
Example #21
0
    // Perform this attack on multiple targets
    public void Perform(GameObject[] area, CharacterData attackerData, FloatingTextManager floatingTxtMgr)
    {
        foreach (GameObject t in area)
        {
            float dmgAmount = Formula.CalculateExplosiveDamage(t.transform.position, Camera.main.ScreenToWorldPoint(Input.mousePosition), attackerData.attackPower);
            if (t.tag == "Player" || t.tag == "Enemy" || t.tag == "Trap" || t.tag == "Collectable")
            {
                t.BroadcastMessage("ApplyDamage", dmgAmount);

                Vector3 textOffset = new Vector3(0, 30);
                floatingTxtMgr.CreateFloatingText(dmgAmount.ToString(), t.transform.position + textOffset, this.CategoryColor().fontColor, this.CategoryColor().outlineColor);
                DmgEffectManager.CreateHit(t.transform.position);
            }
        }
    }
Example #22
0
    public void Perform(GameObject[] targets, CharacterData attackerData, FloatingTextManager floatingTxtMgr)
    {
        // Apply heal to all targets
        foreach (GameObject t in targets)
        {
            float healAmount = Formula.CalculateExplosiveDamage(t.transform.position, Camera.main.ScreenToWorldPoint(Input.mousePosition), attackerData.healPower);
            if (t.tag == "Player" || t.tag == "Enemy")
            {
                t.BroadcastMessage("ApplyHeal", healAmount);

                Vector3 textOffset = new Vector3(0, 30);
                floatingTxtMgr.CreateFloatingText(healAmount.ToString(), t.transform.position + textOffset, this.CategoryColor().fontColor, this.CategoryColor().outlineColor);
            }
        }
    }
Example #23
0
    public void Perform(GameObject target, CharacterData attackerData, FloatingTextManager floatingTxtMgr)
    {
        float suppressAmount = 5 + (attackerData.level / 10);

        BattleManager.ActiveCharacter.PlayShootAnim();

        // Apply dmg to target
        if (target.tag == "Player" || target.tag == "Enemy")
        {
            target.BroadcastMessage("Suppress", suppressAmount);

            Debug.Log("Suppress fire fired");
            Vector3 textOffset = new Vector3(0, 30);
            floatingTxtMgr.CreateFloatingText("Recovery +" + suppressAmount.ToString(), target.transform.position + textOffset, this.CategoryColor().fontColor, this.CategoryColor().outlineColor);
        }
    }
Example #24
0
    // Use this for initialization
    void Start()
    {
        FloatingTextManager.Initialise();
        //find the two spawners to acces scripts
        m_pieSpawner = GameObject.FindGameObjectWithTag("PieSpawner");
        m_pedSpawner = GameObject.FindGameObjectWithTag("PedSpawner");

        m_pieSplatSound = this.GetComponent <AudioSource>();

        //get the script and component references
        m_pieScript         = m_pieSpawner.GetComponent <PieScript>();
        m_gameManagerScript = m_pedSpawner.GetComponent <PieThrowManagerScript>();
        m_sr = gameObject.GetComponent <SpriteRenderer>();
        m_pieSpriteManager = gameObject.GetComponent <PieSpriteChanger> ();

        m_isHit = false;
    }
Example #25
0
    // Use this for initialization
    void Start()
    {
        if (instance != null)
        {
            Destroy(instance.gameObject);
        }

        instance = this;

        floatingTextManager = GetComponent <FloatingTextManager>();
        healthBarManager    = GetComponent <HealthBarManager>();
        playerGUI           = GetComponent <PlayerGUI>();
        itemPopup           = itemPopupObject.GetComponent <ItemPopup>();
        loadScreen          = GetComponent <LoadScreen>();
        deathScreen         = GetComponent <DeathScreen>();
        bossGUI             = GetComponent <BossGUI>();
    }
Example #26
0
 void Awake()
 {
     if (_instance == null)
     {
         //If I am the fist instance, make me the first Singleton
         _instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         //If a Singleton already exists and you find another reference in scene, destroy it
         if (_instance != this)
         {
             Destroy(gameObject);
         }
     }
 }
Example #27
0
    //if tile is swiped over
    public int Swiped(out BasePlant plant)
    {
        int tempScore = 0;

        plant = basePlant;

        //if the plant is already active
        if (basePlant.GetActive())
        {
            //get the score from the plant
            tempScore = basePlant.GetScore();
            Debug.Log(basePlant.GetScore());

            //if the plant is type of double plant
            if (basePlant is DoubleScorePlant)
            {
                //white text
                FloatingTextManager.CreateFloatingText("+" + basePlant.GetScore().ToString(), basePlant.transform, Color.white);
            }
            else if (basePlant is NormalPlant)
            {
                //yellow text
                FloatingTextManager.CreateFloatingText("+" + basePlant.GetScore().ToString(), basePlant.transform);
            }
            else if (basePlant is DebuffPlant)
            {
                FloatingTextManager.CreateFloatingText("+" + basePlant.GetScore().ToString(), basePlant.transform, Color.blue);
                DebuffPlant debuff = basePlant as DebuffPlant;
                Destroy(lightning);
            }

            //activate the dead plant animation
            m_animator.SetTrigger("DeadPlant");

            //Set the plant state to be inactive
            basePlant.SetActive(false);

            for (int i = 0; i < emmiters.Count; i++)
            {
                emmiters [i].Play();
            }
        }
        return(tempScore);
    }
Example #28
0
    private void OnMouseUp()
    {
        FloatingTextManager ftm = GameObject.FindGameObjectWithTag("Respawn").GetComponent <FloatingTextManager>();

        if (destination != null && Vector3.Distance(gameObject.transform.position, destination.position) < 1.2f && ftm.PuzzlePlaced(index))
        {
            transform.position   = destination.position;
            transform.localScale = new Vector3(1f, 1f, 1f);
            GetComponent <PolygonCollider2D>().enabled = false;
            GetComponent <SpriteRenderer>().sortingOrder--;
            myTween.Kill();
            if (hasRotation)
            {
                hasRotation        = false;
                transform.rotation = Quaternion.identity;
            }
        }
        else
        {
            myTween.Play();
        }
    }
 void Awake()
 {
     gameLogic = GameObject.Find("GameGlobal").GetComponent <GameLogic>();
     if (gameLogic == null)
     {
         Debug.Log("Error: <gameLogic> not found!");
     }
     timerText = GetComponent <TextMeshProUGUI>();
     if (timerText == null)
     {
         Debug.Log("Error: <timerText> not found!");
     }
     floatingTextManager = GameObject.Find("FloatingTextManager").GetComponent <FloatingTextManager>();
     if (floatingTextManager == null)
     {
         Debug.Log("Error: <floatingTextManager> not found!");
     }
     player = GameObject.FindGameObjectWithTag("Player");
     if (player == null)
     {
         Debug.Log("Error: <player> not found!");
     }
 }
 private void Start()
 {
     Instance = this;
 }