Example #1
0
    void Awake()
    {
        /*
         * int width = Screen.width;
         * int height = Screen.width * 10 / 16;
         * Application.targetFrameRate = 60;
         * Screen.SetResolution(width, height, true);
         */

        _CSV  = new CSVParser();
        _Json = new JsonParser();

        GDB = GameDataBase.getDBinstance;

        //isTutoSystem = GDB.getUserDB.getPlayerIntData("gameCount") == 1;
        //isTutoSystem = getUserIntData("gameCount") == 1;
        // Scene Init
        if (SceneManager.GetActiveScene().name.Equals("Game"))
        {
            TempStaticMemory.isOpenPopUp = false;
            //TempStaticMemory.playCount = PlayerPrefs.GetInt("GameCount", 0);

            TempStaticMemory.playCount = getUserIntData("gameCount");

            if (TempStaticMemory.playCount == 0)
            {
                //SendToUI("ShowTrophyDisplayPopUp", 0);
            }
            GameObject scripts = transform.FindChild("ScriptCollect").gameObject;

            Attack_Control   = scripts.GetComponent <AttackerController>();
            Player_Control   = scripts.GetComponent <PlayerController>();
            Obstacle_Control = scripts.GetComponent <ObstacleController> ();
        }
    }
    void OnTriggerEnter2D(Collider2D col)
    {
        AttackerController attacker = col.gameObject.GetComponent <AttackerController> ();

        if (attacker != null)
        {
            Application.LoadLevel("03b Lose");
        }
    }
Example #3
0
    private static float RangeScore(GameObject obj)
    {
        AttackerController atc = obj.GetComponent <AttackerController>();
        SentryController   sc  = obj.GetComponent <SentryController>();

        if (atc)
        {
            return(atc.HoldRange);
        }
        else if (sc)
        {
            return(sc.AttackRange / 4f); // Since they can't move, they effectively have sagnificantly reduced range. Number is magic LOL
        }
        return(0f);
    }
    //isTimeToSpawn function to check in this frame, shall we need to instantiate a new attacker
    bool isTimeToSpawn(GameObject attackerSpawn)
    {
        AttackerController thisAttacer = attackerSpawn.GetComponent <AttackerController> ();                    //Get the AttackerController of the specific instantiate attacker
        float spawnRate      = thisAttacer.spawnRate;                                                           //Get the spawnRate of the specific attacker
        float spawnPerSecond = 1 / spawnRate;                                                                   //Calculate how many of this type of accakcer will be instantiated per second

        float temp  = spawnPerSecond * Time.deltaTime / 10;
        float check = Random.value;

        if (check < temp)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Example #5
0
    private float lizardHP;                                                     //Define the HP of lizard

    // Use this for initialization
    void Start()
    {
        anim     = GetComponent <Animator> ();                          //Get the Animator variable
        attacker = GetComponent <AttackerController> ();                //Get the AttackerController viriable
    }
Example #6
0
    private AttackerController attacker;        //Define the AttackerController variable

    // Use this for initialization
    void Start()
    {
        anim     = GetComponent <Animator>();                           //Get the Animator of the gameobject
        attacker = GetComponent <AttackerController> ();                //Get the AttackerController of the gameobject
    }