示例#1
0
 // Use this for initialization
 void Start()
 {
     //Player initial stat
     userInfo.inventory = new WeaponDB.weapon[20];                                   //Initiating Player's card inventory
     WeaponDB.getCard("cone-stick", ref userInfo, 1, 1);
     WeaponDB.getCard("laser-once", ref userInfo, 2, 1);
     userInfo.type        = 0;
     userInfo.hp          = 100;
     gameObject.tag       = "Player";
     userInfo.currentCard = 1;
     userInfo.heatMax     = 200;
     userInfo.heat        = userInfo.heatMax;
     userInfo.barrelPos   = new Vector3(0, 0.25f, 0);
     userInfo.weakShot    = 0;
 }
示例#2
0
    void Initiate()
    {
        // Enemy properties
        userInfo.type        = 2;
        userInfo.inventory   = new WeaponDB.weapon[20];                 //Initiating Enemy's card inventory
        gameObject.tag       = "Enemy";
        userInfo.currentCard = 1;                                       //TEMP
        userInfo.heatMax     = 100;
        //startFirePattern (int slotID, int gap, int randomGap, int continuous, int continuousGap, int randomContinuous)
        switch (enemyID)
        {
        // TODO: all cardLevel = stageLevel
        case "tameBat": {                                               // Tame Bat
            WeaponDB.getCard("enemy-cone-stick", ref userInfo, 1, 1);
            userInfo.hp        = 5f;
            userInfo.barrelPos = new Vector3(0, -0.2f, 0);
            StartCoroutine(startFirePattern(1, 1000, 7000, 1, 0, 0));
            break;
        }

        case "heatemitBat": {                                           // Heat-Emit Bat
            WeaponDB.getCard("enemy-surround-ball", ref userInfo, 1, 8);
            userInfo.hp        = 5f;
            userInfo.barrelPos = new Vector3(0, 0, 0);
            gameObject.GetComponent <SpriteRenderer>().color = Color.red;
            StartCoroutine(startFirePattern(1, 1000, 10000, 3, 100, 0));
            break;
        }

        case "accurateBat": {                                           // Accurate Bat
            WeaponDB.getCard("enemy-cone-ball-targetPlayer", ref userInfo, 1, 1);
            userInfo.hp        = 5f;
            userInfo.barrelPos = new Vector3(0, -0.2f, 0);
            gameObject.GetComponent <SpriteRenderer>().color = Color.blue;
            StartCoroutine(startFirePattern(1, 1000, 7000, 1, 0, 0));
            break;
        }

        case "burstyBat": {                                             // Bursty Bat
            WeaponDB.getCard("enemy-burst-ball-targetPlayer", ref userInfo, 1, 6);
            userInfo.hp        = 5f;
            userInfo.barrelPos = new Vector3(0, -0.2f, 0);
            gameObject.GetComponent <SpriteRenderer>().color = Color.yellow;
            StartCoroutine(startFirePattern(1, 5000, 7000, 1, 0, 0));
            break;
        }

        case "random3Bat": {                                            // Random3 Bat
            WeaponDB.getCard("enemy-burst-ball-targetPlayer", ref userInfo, 1, 4);
            userInfo.hp        = 3f;
            userInfo.barrelPos = new Vector3(0, -0.2f, 0);
            gameObject.GetComponent <SpriteRenderer>().color = Color.green;
            StartCoroutine(startFirePattern(1, 2000, 8000, 2, 250, 0));
            break;
        }

        case "tankyannoyingBat": {                                              // Tanky annoying bat
            WeaponDB.getCard("enemy-burst-ball-targetPlayer", ref userInfo, 1, 6);
            userInfo.hp        = 20f;
            userInfo.barrelPos = new Vector3(0, -0.2f, 0);
            gameObject.GetComponent <SpriteRenderer>().color = Color.magenta;
            StartCoroutine(startFirePattern(1, 3000, 0, 3, 250, 0));
            break;
        }

        case "surroundBat": {                                           // Surround bat
            WeaponDB.getCard("enemy-surround-ball", ref userInfo, 1, 6);
            userInfo.hp        = 5f;
            userInfo.barrelPos = new Vector3(0, -0.2f, 0);
            gameObject.GetComponent <SpriteRenderer>().color = Color.cyan;
            StartCoroutine(startFirePattern(1, 3000, 7000, 1, 0, 0));
            break;
        }
        }
        //userInfo.heat = userInfo.heatMax;
        //

        // Enemy movement variable (Startup)
        switch (enemyBatch)
        {
        // Zig-Zag Approaching
        case "autoZigzagPlayer": {
            //enemyVar[1]: player position x
            //enemyVar[2]: player position y
            enemyVar[3] = 1000;                                                         // Increasing time, instantly move after spawning
            enemyVar[5] = 0;                                                            //5; 6: Random value, enemy move toward near player
            enemyVar[6] = 0;
            break;
        }

        // Random movement
        case "autoRandomXY": {
            //enemyVar[1]: destination position x
            //enemyVar[2]: destination position y
            enemyVar[3] = 1000;                                                         // Increasing time, instantly move randomly after spawning
            enemyVar[4] = 0;                                                            // Refresh rate time gap. Starts as 0 as enemy moves immediately after spawning, update afterward
            break;
        }

        // Sin-Wave & Curve:
        case "sinRightDes":
        case "sinLeftDes":
        case "sinRightAsc":
        case "sinLeftAsc":
        case "sinDown":
        case "curveRight":
        case "curveLeft": {                             //Apply for y=sin(x), y=(x/a)^b
            enemyVar[1] = 0;                            //static x
            enemyVar[2] = 0;                            //static y
            enemyVar[3] = transform.position.x;         //Spawn position; both static x and y will calculate y=sin(x) separately, + currentPos afterward in here
            enemyVar[4] = transform.position.y;
            break;
        }
        }
    }
示例#3
0
 //DEBUG: Level Up
 public void WeaponLevelUp()
 {
     WeaponDB.getCard(userInfo.inventory[userInfo.currentCard].id, ref userInfo, userInfo.currentCard, 1);
 }