private float moveTime = 4.0f;          // Time at which BG starts moving

    // Set BG layer speeds, Get Gamemaster
    private void Start()
    {
        // Set move speed & reset position for all background elements
        if (this.name == "Background Tile")
        {
            moveSpeed = 0.05f;
            posReset  = 2 * 78.25f;
        }
        if (this.name == "Pillars Tile")
        {
            moveSpeed = 0.075f;
            posReset  = 2 * 76.73f;
        }
        if (this.name == "Ground Tile")
        {
            moveSpeed = 0.1f;
            posReset  = 2 * 78.34f;
        }

        // Get Gamemaster
        if (gm == null)
        {
            gm = GameObject.Find("Gamemaster").GetComponent <Gamemaster>();
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     r2          = gameObject.GetComponent <Rigidbody2D>();
     anim        = gameObject.GetComponent <Animator>();
     gm          = GameObject.FindGameObjectWithTag("gamemaster").GetComponent <Gamemaster>();
     ourHealth   = maxHealth;
     audioSource = gameObject.GetComponent <AudioSource>();
 }
Exemplo n.º 3
0
    // Use this for initialization
    void Awake()
    {
        stats.position = transform.position;
        GameObject g = GameObject.Find("GameMaster");

        gm = g.GetComponent <Gamemaster>();

        stats.currHealth = stats.maxHealth;
    }
Exemplo n.º 4
0
    void Start()
    {
        r2bd = gameObject.GetComponent <Rigidbody2D>();
        anim = gameObject.GetComponent <Animator>();
        gm   = GameObject.FindGameObjectWithTag("GameMaster").GetComponent <Gamemaster>(); //Khởi tạo đối tượng bộ đếm gm
        Coin = GameObject.FindGameObjectWithTag("Coin").GetComponent <Coin>();             //khởi tạo đối tượng coin

        curHeath = maxHealth;                                                              // khi start thi thanh mau se max
    }
Exemplo n.º 5
0
    // Get GM, player
    private void Awake()
    {
        // Get Gamemaster
        if (gm == null)
        {
            gm = GameObject.Find("Gamemaster").GetComponent <Gamemaster>();
        }

        // Get PlayerStats
        stats = GameObject.Find("Player").GetComponent <PlayerStats>();
    }
Exemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     r2        = gameObject.GetComponent <Rigidbody2D>();
     anim      = gameObject.GetComponent <Animator>();
     gm        = GameObject.FindGameObjectWithTag("Gamemaster").GetComponent <Gamemaster>();
     newhealth = maxhealth;
     healthBar.SetMaxHealth(newhealth);
     cherry   = gameObject.GetComponent <Cherry>();
     gem      = gameObject.GetComponent <Gem>();
     location = transform.position;
 }
Exemplo n.º 7
0
    public void Awake()
    {
        status           = gameObject.GetComponent <Status>();
        animationHandler = GetComponent <AnimationHandler>();

        if (tag == EntityTag.Player)
        {
            inventory = GetComponent <InventoryHandler>();
        }

        gm = GameObject.FindGameObjectWithTag("ModLoader").GetComponent <Gamemaster>();
    }
Exemplo n.º 8
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(instance);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 9
0
    private void Start()
    {
        startUpTime = Random.Range(0, 200) / 100;
        gm          = GameObject.FindGameObjectWithTag("ModLoader").GetComponent <Gamemaster>();
        l           = GetComponent <Light>();
        if (l == null)
        {
            Destroy(this);
        }
        intensity = l.intensity;

        timeStamp = Time.time + startUpTime;
    }
Exemplo n.º 10
0
    // Get gate parts, gamemaster
    void Start()
    {
        // Get gate parts
        gateLeft        = GameObject.Find("Gate Left");
        gateLeftSprite  = GameObject.Find("Gate Left").GetComponent <SpriteRenderer>();
        gateRight       = GameObject.Find("Gate Right");
        gateRightSprite = GameObject.Find("Gate Right").GetComponent <SpriteRenderer>();

        // Get Gamemaster
        if (gm == null)
        {
            gm = GameObject.Find("Gamemaster").GetComponent <Gamemaster>();
        }
    }
Exemplo n.º 11
0
    // Get gamemaster, playerstats
    void Start()
    {
        // Get Gamemaster
        if (gm == null)
        {
            gm = GameObject.Find("Gamemaster").GetComponent <Gamemaster>();
        }

        // Get PlayerStats
        if (stats == null)
        {
            stats = GetComponent <PlayerStats>();
        }
    }
Exemplo n.º 12
0
    private GameObject Pause;                           // Pause menu object

    // Get UI elements, PlayerStats, Gamemaster, Bosses, Curtain, Weapon Images
    private void Start()
    {
        // Get Gamemaster
        if (gm == null)
        {
            gm = GameObject.Find("Gamemaster").GetComponent <Gamemaster>();
        }

        // Get buttons
        volume = GameObject.Find("Button: Volume").GetComponent <Button>();

        // Get fading curtain
        blackCurtain = GameObject.Find("Black Curtain").GetComponent <FadeInAndOut>();

        // Get level UI elements
        if (SceneManager.GetActiveScene().name != "menu" &&
            SceneManager.GetActiveScene().name != "shop" &&
            SceneManager.GetActiveScene().name != "gameover")
        {
            stats                   = GameObject.Find("Player").GetComponent <PlayerStats>();                   // PlayerStats
            healthDisplay           = GameObject.Find("Text: Health").GetComponent <Text>();                    // Health text
            healthDisplayBG         = GameObject.Find("Image: Health BG").GetComponent <Image>();               // Health BG
            moneyDisplay            = GameObject.Find("Text: Money").GetComponent <Text>();                     // Money text
            moneyDisplayBG          = GameObject.Find("Image: Money BG").GetComponent <Image>();                // Money BG
            attackReady             = GameObject.Find("Image: Attack ready").GetComponent <Image>();            // Attach ready indicator
            bossHealthDisplay       = GameObject.Find("Text: Boss Health").GetComponent <Text>();
            bossHealthDisplay.color = new Color(0f, 0f, 0f, 0f);
            bossHealthBG            = GameObject.Find("Image: Boss Health BG").GetComponent <Image>();
            bossHealthBG.color      = new Color(0f, 0f, 0f, 0f);
            Pause                   = GameObject.Find("Pause");                                                                                                 // Pause menu
            Pause.SetActive(false);                                                                                                                             // Pause is inactive at level start

            // Get Bosses, hide their health display until entry is done
            if (SceneManager.GetActiveScene().buildIndex == 1)
            {
                boss1 = GameObject.Find("Boss1").GetComponent <Boss1> ();
            }
            else if (SceneManager.GetActiveScene().buildIndex == 2)
            {
                boss2 = GameObject.Find("Boss2").GetComponent <Boss2> ();
            }
//			else if (SceneManager.GetActiveScene ().buildIndex == 3) {
//				boss3 = GameObject.Find ("Boss3").GetComponent<Boss3> ();
//			} else if (SceneManager.GetActiveScene ().buildIndex == 4) {
//				boss4 = GameObject.Find ("Boss4").GetComponent<Boss4> ();
//			} else if (SceneManager.GetActiveScene ().buildIndex == 5) {
//				boss5 = GameObject.Find ("Boss5").GetComponent<Boss5> ();
//			}
        }
    }
Exemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     checkGem = true;
     r2       = gameObject.GetComponent <Rigidbody2D>();
     anim     = gameObject.GetComponent <Animator>();
     gm       = GameObject.FindGameObjectWithTag("Gamemaster").GetComponent <Gamemaster>();
     // ourHealth = maxhealth;
     newhealth = maxhealth;
     healthBar.SetMaxHealth(newhealth);
     cherry   = gameObject.GetComponent <Cherry>();
     gem      = gameObject.GetComponent <Gem>();
     location = transform.position;
     //âm thanh
     sound = GameObject.FindGameObjectWithTag("sound").GetComponent <SoundManager>();
 }
Exemplo n.º 14
0
 // Use this for initialization
 void Start()
 {
     facingRight  = true;
     myRigidbody  = GetComponent <Rigidbody2D>();
     myAnimator   = GetComponent <Animator>();
     ourHealth    = maxHealth;
     gm           = GameObject.FindGameObjectWithTag("gamemaster").GetComponent <Gamemaster>();
     soundManager = GameObject.FindGameObjectWithTag("Sounds").GetComponent <SoundManager>();
     at           = GameObject.FindGameObjectWithTag("attri").GetComponent <AttackPlayer>();
     te           = GameObject.FindGameObjectWithTag("Enemy").GetComponent <TestEnemy>();
     eyybd        = GameObject.FindGameObjectWithTag("Enemy1").GetComponent <EnemyyBlood>();
     // ob = GameObject.FindGameObjectWithTag("Oc").GetComponent<OcBlood>();
     // ns = GameObject.FindGameObjectWithTag("Nhim").GetComponent<NhimScrips>();
     dead = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <DeadUI>();
 }
    void InitOnce()
    {
        // Setup singleton pattern
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }

        Logger.Instance.CreateLog();
        uiComponent = transform.GetComponent <UIComponent>();
        sf          = GetComponentInChildren <ShipFactory>();
        gma         = GetComponent <GamemasterAgent>();
    }
Exemplo n.º 16
0
    private float boundary = -35.0f;            // Destroy offscreen boundary
    #endregion

    #region Methods
    // Get Gamemaster, PlayerStats, Set semi-random speed
    private void Awake()
    {
        // Get Gamemaster
        if (gm == null)
        {
            gm = GameObject.Find("Gamemaster").GetComponent <Gamemaster>();
        }

        // Get PlayerStats
        stats = GameObject.Find("Player").GetComponent <PlayerStats>();

        // Set speed
        speed = Random.Range(speedMin, speedMax);

        // Get animator
        animator = GetComponent <Animator>();
    }
Exemplo n.º 17
0
    private float coinPickupResetMin = 3.0f;            // How often will pickups be spawned?
    #endregion

    #region Methods
    // Get self (gamemaster), Audiomaster, Add spoon to owned weapons
    private void Start()
    {
        // Get Gamemaster
        if (gm == null)
        {
            gm = GameObject.Find("Gamemaster").GetComponent <Gamemaster>();
        }

        // Get Audiomaster
        if (sfx == null)
        {
            sfx = GameObject.Find("Audiomaster").GetComponent <SFX>();
        }

        // Add default weapon spoon to owned weapons
        ownedWeapons[0] = "Spoon";
    }
Exemplo n.º 18
0
    private int enemyWorth;                                             // Money gained from defeating enemies (depends on level)
    #endregion

    #region Methods
    // Get Gamemaster, SFX, Player
    private void Start()
    {
        // Get Gamemaster
        if (gm == null)
        {
            gm = GameObject.Find("Gamemaster").GetComponent <Gamemaster>();
        }

        // Get Audiomaster
        if (sfx == null)
        {
            sfx = GameObject.Find("Audiomaster").GetComponent <SFX>();
        }

        // Get PlayerStats
        stats = GameObject.Find("Player").GetComponent <PlayerStats>();

        // Set enemyWorth depending on level
        int currentLevel = SceneManager.GetActiveScene().buildIndex;

        switch (currentLevel)
        {
        case 1:
            enemyWorth = 5;
            break;

        case 2:
            enemyWorth = 5;
            break;

        case 3:
            enemyWorth = 10;
            break;

        case 4:
            enemyWorth = 10;
            break;

        case 5:
            enemyWorth = 20;
            break;
        }
    }
Exemplo n.º 19
0
    private float attackAnimation;                              // Duration of attack animation
    #endregion

    #region Methods
    // GM, AM, UI, Animator, Weapons, Bosses
    void Start()
    {
        // Get Gamemaster
        if (gm == null)
        {
            gm = GameObject.Find("Gamemaster").GetComponent <Gamemaster>();
        }

        // Get Audiomaster
        if (sfx == null)
        {
            sfx = GameObject.Find("Audiomaster").GetComponent <SFX>();
        }

        // Get UI
        ui = GameObject.Find("Canvas: Game UI").GetComponent <UIMaster>();

        // Get Animator
        playerAnimator = GetComponent <Animator>();

        // Get weapon objects
        Spoon = GameObject.Find("Weapon: Spoon");
        Ball  = GameObject.Find("Weapon: Ball");
        Club  = GameObject.Find("Weapon: Club");
        Gun   = GameObject.Find("Weapon: Gun");

        // Add weapons to their respective lists
        allWeapons = new GameObject[] { Spoon, Ball, Club, Gun };

        // If player has no weapon equipped, set it to default (spoon)
        if (activeWeapon == null)
        {
            activeWeapon = Spoon;
            float[] activeWeaponStats = Spoon.GetComponent <Weapon>().GetSpoonStats();
            attackPower     = activeWeaponStats[0];
            attackReload    = activeWeaponStats[1];
            attackAnimation = activeWeaponStats[2];
        }

        // Get equippable weapons
        ownedWeaponsStrings = gm.GetOwnedWeapons();
    }
Exemplo n.º 20
0
    private bool attackDone;                    // Used for animator

    // Get Gamemaster, SFX, Animator, Curtain
    private void Start()
    {
        // Get Gamemaster
        if (gm == null)
        {
            gm = GameObject.Find("Gamemaster").GetComponent <Gamemaster>();
        }

        // Get Audiomaster
        if (sfx == null)
        {
            sfx = GameObject.Find("Audiomaster").GetComponent <SFX>();
        }

        // Get Animator
        bossAnimator = GetComponent <Animator>();

        // Get fading curtain
        blackCurtain = GameObject.Find("Black Curtain").GetComponent <FadeInAndOut>();
    }
Exemplo n.º 21
0
        new Color(1.0f, 1.0f, 0f, 1.0f);        // Money display brifly takes on this color on pickup

    // Get GM, AM, stats, UI
    private void Awake()
    {
        // Get Gamemaster
        if (gm == null)
        {
            gm = GameObject.Find("Gamemaster").GetComponent <Gamemaster>();
        }

        // Get Audiomaster
        if (sfx == null)
        {
            sfx = GameObject.Find("Audiomaster").GetComponent <SFX>();
        }

        // Get PlayerStats
        stats = GameObject.Find("Player").GetComponent <PlayerStats>();

        // Get UI
        ui = GameObject.Find("Canvas: Game UI").GetComponent <UIMaster>();
    }
Exemplo n.º 22
0
    private void Start()
    {
        inventory = new ItemEntity[UI_CONSTS.INV_SIZE.x, UI_CONSTS.INV_SIZE.y];
        hotbar    = new ItemEntity[UI_CONSTS.INV_SIZE.x];

        gameMaster   = GameObject.FindGameObjectWithTag("ModLoader").GetComponent <Gamemaster>();
        gameDatabase = gameMaster.gameObject.GetComponent <GameDatabase>();

        for (int x = 0; x < inventory.GetLength(0); x++)
        {
            for (int y = 0; y < inventory.GetLength(1); y++)
            {
                inventory[x, y] = new ItemEntity();
            }
        }

        for (int i = 0; i < UI_CONSTS.INV_SIZE.x; i++)
        {
            hotbar[i] = new ItemEntity();
        }

        GiveItem();
    }
Exemplo n.º 23
0
    //private Rigidbody2D frog;

    // Use this for initialization
    void Start()
    {
        //frog = gameObject.GetComponent<Rigidbody2D>();
        gm = GameObject.FindGameObjectWithTag("GameMaster").GetComponent <Gamemaster>();
    }
Exemplo n.º 24
0
 public void Initialize(Gamemaster gm)
 {
     gamemaster = gm;
 }
Exemplo n.º 25
0
 // Use this for initialization
 void Start()
 {
     gm    = GameObject.FindGameObjectWithTag("Gamemaster").GetComponent <Gamemaster>();
     sound = GameObject.FindGameObjectWithTag("sound").GetComponent <SoundManager>();
 }
Exemplo n.º 26
0
 // Use this for initialization
 void Start()
 {
     gm = GameObject.FindGameObjectWithTag("gamemaster").GetComponent <Gamemaster>();
 }
Exemplo n.º 27
0
 // Start is called before the first frame update
 void Start()
 {
     r  = gameObject.GetComponent <Rigidbody2D>();
     a  = gameObject.GetComponent <Animator>();
     gm = GameObject.FindGameObjectWithTag("Gamemaster").GetComponent <Gamemaster>();
 }
Exemplo n.º 28
0
 public void Initialize(Gamemaster gm)
 {
     return;
 }
Exemplo n.º 29
0
    // Get Gamemaster, Audiomaster, Shop elements, hide certain elements
    void Start()
    {
        // Get Gamemaster
        if (gm == null)
        {
            gm = GameObject.Find("Gamemaster").GetComponent <Gamemaster>();
        }

        // Get Audiomaster
        if (sfx == null)
        {
            sfx = GameObject.Find("Audiomaster").GetComponent <SFX>();
        }

        // Get Shop elements
        buyBall           = GameObject.Find("Button: Buy Ball").GetComponent <Button>();
        buyClub           = GameObject.Find("Button: Buy Club").GetComponent <Button>();
        buyGun            = GameObject.Find("Button: Buy Gun").GetComponent <Button>();
        ballSoldOut       = GameObject.Find("Image: Ball Sold out").GetComponent <SpriteRenderer>();
        clubSoldOut       = GameObject.Find("Image: Club Sold out").GetComponent <SpriteRenderer>();
        gunSoldOut        = GameObject.Find("Image: Gun Sold out").GetComponent <SpriteRenderer>();
        ballPriceText     = GameObject.Find("Text: Ball Price").GetComponent <Text>();
        clubPriceText     = GameObject.Find("Text: Club Price").GetComponent <Text>();
        gunPriceText      = GameObject.Find("Text: Gun Price").GetComponent <Text>();
        itemBought        = GameObject.Find("Text: Bought item").GetComponent <Text>();
        insufficientFunds = GameObject.Find("Text: Insufficient funds").GetComponent <Text>();
        itemOwned         = GameObject.Find("Text: Item Owned").GetComponent <Text>();
        funds             = GameObject.Find("Text: Funds").GetComponent <Text>();

        // If the ball is not owned, hide sold-out cross, else show it and change text
        if (gm.GetOwnedWeapons()[1] == null)
        {
            ballSoldOut.enabled = false;
        }
        else
        {
            ballPriceText.text = "Sold out";
        }

        // If the club is not owned, hide sold-out cross, else show it and change text
        if (gm.GetOwnedWeapons()[2] != "Club")
        {
            clubSoldOut.enabled = false;
        }
        else
        {
            clubPriceText.text = "Sold out";
        }

        // If the gun is not owned, hide sold-out cross, else show it and change text
        if (gm.GetOwnedWeapons()[3] != "Gun")
        {
            gunSoldOut.enabled = false;
        }
        else
        {
            gunPriceText.text = "Sold out";
        }

        // Hide info texts
        itemBought.enabled        = false;
        insufficientFunds.enabled = false;
        itemOwned.enabled         = false;
    }
Exemplo n.º 30
0
 // Get Gamemaster, Animator
 void Awake()
 {
     // Get Gamemaster and Animator
     gm = GameObject.Find("Gamemaster").GetComponent <Gamemaster>();
     countdownAnimator = GetComponent <Animator>();
 }