예제 #1
0
    //comes in without gravity
    public IEnumerator Phase1()
    {
        portalNum = ourMaster.portalNum;
        ourMaster.portalNum++;
        phase1 = true;
        yield return(new WaitForSeconds(time2Set));

        set = true;
        rigidbody2D.velocity = Vector2.zero;
        teleportalBlocks     = GameObject.FindObjectsOfType <TeleportalBlock> ();
        if (phase1)
        {
            foreach (TeleportalBlock portal in teleportalBlocks)
            {
                if (portal.portalNum != portalNum && portal.buddyPortalNum == 0 && portal.set)
                {
                    buddyPortal                         = portal.gameObject;
                    buddyPortalScript                   = portal;
                    buddyPortalScript.buddyPortal       = this.gameObject;
                    buddyPortalScript.buddyPortalScript = this;
                    buddyPortalNum                      = buddyPortalScript.portalNum;
                    buddyPortalScript.buddyPortalNum    = portalNum;
                    StartCoroutine(buddyPortalScript.Phase2());
                    StartCoroutine(Phase2());
                    teleState = 2;
                    buddyPortalScript.teleState = 1;
                    StartCoroutine(CounterSyncedPortalAnimation());
                    break;
                }
            }
            yield return(null);
        }
    }
예제 #2
0
 //comes in without gravity
 public IEnumerator Phase1()
 {
     portalNum = ourMaster.portalNum;
     ourMaster.portalNum++;
     phase1 = true;
     yield return new WaitForSeconds (time2Set);
     set = true;
     rigidbody2D.velocity = Vector2.zero;
     teleportalBlocks = GameObject.FindObjectsOfType<TeleportalBlock> ();
     if (phase1){
         foreach (TeleportalBlock portal in teleportalBlocks) {
             if (portal.portalNum != portalNum && portal.buddyPortalNum==0 && portal.set){
                 buddyPortal = portal.gameObject;
                 buddyPortalScript = portal;
                 buddyPortalScript.buddyPortal = this.gameObject;
                 buddyPortalScript.buddyPortalScript = this;
                 buddyPortalNum = buddyPortalScript.portalNum;
                 buddyPortalScript.buddyPortalNum = portalNum;
                 StartCoroutine (buddyPortalScript.Phase2 ());
                 StartCoroutine (Phase2());
                 teleState = 2;
                 buddyPortalScript.teleState = 1;
                 StartCoroutine (CounterSyncedPortalAnimation());
                 break;
             }
         }
         yield return null;
     }
 }
예제 #3
0
    public IEnumerator LaunchOverIt()
    {
        StartCoroutine(CatalogWeapons());
        StartCoroutine(StopChargeNoise());
        StartCoroutine(chargeDisplay.StopCharger());
        if (blockInSlot)
        {
            if (chargeDisplay.charger != 0 & !waiting)
            {
                //TRIGGER RELEASE BUNDLE// (see below)
                waiting = true;
                launchCount++;
                StartCoroutine(ReleaseNoise());
                StartCoroutine(KickBack());
                StartCoroutine(InitialPassThrough());
                if (c1)
                {
                    StartCoroutine(cameraFollowPlayer1.Shake());
                }
                else
                {
                    StartCoroutine(cameraBattleArena.Shake());
                }

                //things that happen to ALL fired weapons

                blockInSlot.rigidbody2D.WakeUp();
                if (blockTypes[0] != 7 && blockTypes[0] != 8 && blockTypes[0] != 13)            //telekineticblocks should float
                {
                    blockInSlot.rigidbody2D.gravityScale = 1f;
                }
                if (blockTypes[0] != 11 && blockTypes[0] != 12)              //turretblocks should stay small
                //blockInSlot.transform.localScale = Vector3.one * 3f;
                {
                }
                charger = chargeDisplay.charger;
                blockInSlot.rigidbody2D.velocity = Vector2.zero;
                yield return(new WaitForEndOfFrame());

                blockInSlot.rigidbody2D.AddForce(fDir * (baselineFire + fireSpeed * charger));
                blockInSlot.collider2D.isTrigger = false;
                occupied    = false;
                wasOccupied = false;

                //Special things that those special blocks do
                if (blockInSlot.GetComponent <WeaponBlockScript> ())
                {
                    weaponBlockScript = blockInSlot.GetComponent <WeaponBlockScript> ();
                    StartCoroutine(weaponBlockScript.Project());
                }

                switch (blockTypes[0])
                {
                case 2:
                    Explode explode = blockInSlot.GetComponent <Explode>();
                    StartCoroutine(explode.BlowMe());
                    break;

                case 3:
                    Freeze freezeScript = blockInSlot.GetComponent <Freeze>();
                    freezeScript.nowProjectile = true;
                    break;

                case 4:
                    NeutralSuper neutralSuper = blockInSlot.GetComponent <NeutralSuper>();
                    StartCoroutine(neutralSuper.BreakUp());
                    break;

                case 5:
                    ExplodeSuper explodeSuper = blockInSlot.GetComponent <ExplodeSuper>();
                    StartCoroutine(explodeSuper.GetIntimate());
                    break;

                case 6:                 // super freeze
                    SuperFreezeBlock freezeSuper = blockInSlot.GetComponent <SuperFreezeBlock>();
                    freezeSuper.wepDSID = wepDSID;
                    break;

                case 7:                 //telekinetic block
                    telekineticBlockScript = blockInSlot.GetComponent <TelekineticBlock>();
                    occupied    = true;
                    wasOccupied = true;

                    telekineticBlockScript.weaponDetectorScript = this;
                    telekineticBlockScript.heroSpot             = arm;
                    telekineticBlockScript.player  = player;
                    telekineticBlockScript.wepDSID = wepDSID;
                    telekineticBlockScript.GetComponent <WeaponBlockScript>().wepDSID = wepDSID;

                    StartCoroutine(TeleBlockCheck());
                    StartCoroutine(telekineticBlockScript.Orbit());
                    StartCoroutine(telekineticBlockScript.StartingOff());
                    break;

                case 8:                 //super telekinetic block
                    superTelekineticBlockScript = blockInSlot.GetComponent <SuperTelekineticBlock>();
                    superTelekineticBlockScript.weaponDetectorScript = this;
                    superTelekineticBlockScript.character            = character;
                    superTelekineticBlockScript.wepDSID = wepDSID;
                    superTelekineticBlockScript.GetComponent <WeaponBlockScript> ().wepDSID = wepDSID;

                    GameObject expo = Instantiate(Resources.Load("Prefabs/Effects/Telesplosion"), hPos, Quaternion.identity) as GameObject;
                    expo.transform.localScale = Vector3.one;

                    StartCoroutine(superTelekineticBlockScript.Welcome());
                    break;

                case -1:
                    MiniCopterBlock miniCopterBlock = blockInSlot.GetComponent <MiniCopterBlock>();
                    StartCoroutine(miniCopterBlock.BeFree());
                    break;

                case 11:                 //turret block
                    //blockInSlot.transform.localScale = Vector3.one;
                    break;

                case 12:                 //super turret block
                    //blockInSlot.transform.localScale = Vector3.one;
                    break;

                case 13:
                    TeleportalBlock teleB = blockInSlot.GetComponent <TeleportalBlock>();
                    StartCoroutine(teleB.Phase1());
                    break;

                case 15:
                    ShockBlock shockb = blockInSlot.GetComponent <ShockBlock>();
                    StartCoroutine(shockb.FlipTheSwitch());
                    break;
                }

                StartCoroutine(CatalogWeapons());
                yield return(new WaitForSeconds(0.01f));

                waiting = false;
                //StartCoroutine (ToggleWeapons());
                yield return(null);
            }
        }
    }