// Use this for initialization
 void Start()
 {
     renderer = GetComponent<SpriteRenderer>();
     renderer.sprite = sprites[0];
     main = Camera.main;
     sub = ScoreManager.Instance.sub;
 }
Example #2
0
 private void Start()
 {
     stats       = Stats.GetInstance;
     sub         = GameObject.Find("Submarine").GetComponent <SubmarineController>();
     ship        = GameObject.Find("ShipyMcShipFace");
     scontroller = ship.GetComponent <ShipController>();
 }
Example #3
0
    void Start()
    {
        //BGM
        soundManager.Instance.StopBgm();
        soundManager.Instance.ChangeBgm(1);

        goText.SetActive(false);
        finishText.SetActive(false);

        submarinePoint = 0;

        shipPoint = 0;

        frameCnt = 0;

        gameTime = gameStartTime;

        gameTimeText.color = new Color(255.0f, 255.0f, 255.0f, 0.0f);

        //ミサイルの生成時間の最大値を決める
        createMissileTimeMax = (int)gameTime * 60 / missileNumMax;

        isCreateMissile = false;

        winner = WINNER.WINNER_NOTHING;

        gamePhase = PHASE.PHASE_START;

        shipController      = ship.GetComponent <ShipController>();
        trashCount          = GameObject.Find("Sea Floor").GetComponent <TrashCount>();
        submarineController = submarine.GetComponent <SubmarineController>();
    }
Example #4
0
 // Use this for initialization
 void Start()
 {
     isOver        = false;
     submarine     = SubmarineController.Instance;
     score         = submarine.score;
     scoreParent   = submarine.scoreParent;
     scoreParticle = (GameObject)Resources.Load("ScoreParticle");
 }
Example #5
0
 void Awake()
 {
     if (Obj == null)
     {
         Obj = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Example #6
0
 void Start()
 {
     subController = submarine.GetComponent <SubmarineController>();
     statValues    = GetComponent <Text>();
 }
Example #7
0
 // Use this for initialization
 void Start()
 {
     possessionText = GetComponent <TextMesh>();
     smc            = submarin.GetComponent <SubmarineController>();
 }
Example #8
0
 void Start()
 {
     subController = submarine.GetComponent <SubmarineController>();
     hpBar         = GetComponent <Image>();
 }
Example #9
0
 // Use this for initialization
 void Start()
 {
     doorCollider = door.GetComponent <BoxCollider>();
     subCtrl      = sub.GetComponent <SubmarineController>();
 }
    void OnTriggerEnter2D(Collider2D other)
    {
        //If player collided with coin, increase the instance point by 10
        if (other.gameObject.tag == "Coin")
        {
            Player.Instance.Points += 10;
            Debug.Log("Collision with" + other.gameObject.tag);
            CoinController coin = other.gameObject.GetComponent <CoinController>();
            if (coin != null)
            {
                GameObject st = Instantiate(star);
                st.transform.position = coin.transform.position;
                coin.Reset();
            }
        }

        //If player collided with PowerCoin, increase the instance health by 10
        if (other.gameObject.tag == "PowerCoin")
        {
            Player.Instance.Health += 10;
            Debug.Log("Collision with" + other.gameObject.tag);
            PowerCoinController powerCoin = other.gameObject.GetComponent <PowerCoinController>();
            if (powerCoin != null)
            {
                GameObject sw = Instantiate(sword);
                sw.transform.position = powerCoin.transform.position;
                powerCoin.destroy();
            }
        }

        //If player collided with shark, game over
        if (other.gameObject.tag == "Shark")
        {
            Player.Instance.Health -= 20;
            Debug.Log("Collision with" + other.gameObject.tag);
            SharkController shark = other.gameObject.GetComponent <SharkController>();
            if (shark != null)
            {
                GameObject bl = Instantiate(blood);
                bl.transform.position = shark.transform.position;
            }
        }

        //If player collided with octopus, decrease the instance health by 10
        else if (other.gameObject.tag == "Octopus")
        {
            Debug.Log("Collision with" + other.gameObject.tag);
            Player.Instance.Health -= 10;
            OctopusController octopus = other.gameObject.GetComponent <OctopusController>();
            if (octopus != null)
            {
                GameObject bl = Instantiate(blood);
                bl.transform.position = octopus.transform.position;
                octopus.Reset();
            }
        }

        //If player collided with submarine, game over
        else if (other.gameObject.tag == "Submarine")
        {
            Debug.Log("Collision with" + other.gameObject.tag);
            Player.Instance.Health -= 30;
            SubmarineController submarine = other.gameObject.GetComponent <SubmarineController>();
            if (submarine != null)
            {
                GameObject bl = Instantiate(blood);
                bl.transform.position = submarine.transform.position;
            }
        }

        //If player collided with submarine, game end
        else if (other.gameObject.tag == "Bullet")
        {
            Debug.Log("Collision with" + other.gameObject.tag);
            Player.Instance.Health = 0;
            BulletController bullet = other.gameObject.GetComponent <BulletController>();
            if (bullet != null)
            {
                GameObject bl = Instantiate(blood);
                bl.transform.position = bullet.transform.position;
                bullet.destroy();
            }
        }
    }
Example #11
0
 void Awake()
 {
     instance = this;
     //PlayerPrefs.SetInt ("gold", 999999999);
     //PlayerPrefs.DeleteAll ();
 }
Example #12
0
 // Start is called before the first frame update
 void Start()
 {
     subController = submarine.GetComponent<SubmarineController>();
     baseSpeed = subController.maxSpeed;
 }
Example #13
0
 void Start()
 {
     main = Camera.main;
     body = GetComponent<Rigidbody>();
     sub = ScoreManager.Instance.sub;
 }