Example #1
0
    void OnTriggerEnter2D(Collider2D localCollider2D)
    {
        if (!locked)
        {
            MegamanController megaman = localCollider2D.GetComponent <MegamanController> ();

            if (megaman != null)
            {
                spawnedEnemies.Remove(null);
                if (spawnedEnemies.Count < objectsToSpawn.Length)
                {
                    foreach (GameObject go in objectsToSpawn)
                    {
                        GameObject objectInstance = Instantiate(go, go.transform.position, go.transform.rotation) as GameObject;
                        spawnedEnemies.Add(objectInstance);
                        objectInstance.SetActive(true);
                    }
                }
            }

            if (delayedSpawn)
            {
                locked = true;
                Invoke("Unlock", spawnDelay);
            }
        }
    }
 public override void Start()
 {
     if (MegamanController.Instance == null)
     {
         MegamanController.Instance = this;
     }
     base.Start();
 }
Example #3
0
 void Awake()
 {
     megamanController    = GameObject.FindObjectOfType <MegamanController> ();
     deathRogumerMovement = GetComponent <DeathRogumerMovement> ();
     if (liftAnimator == null)
     {
         Debug.LogError("The Lift Animator is null. Please set the reference for it to work properly.");
     }
 }
Example #4
0
 void Awake()
 {
     megamanController = GameObject.FindObjectOfType<MegamanController> ();
     deathRogumerMovement = GetComponent<DeathRogumerMovement> ();
     if(liftAnimator == null)
     {
         Debug.LogError("The Lift Animator is null. Please set the reference for it to work properly.");
     }
 }
Example #5
0
    void Awake()
    {
        megamanController = GameObject.FindGameObjectWithTag("Player").GetComponent <MegamanController>();
        direction         = megamanController.direction;

        if (direction == -1)
        {
            GetComponent <SpriteRenderer>().flipX = true;
        }
    }
 protected override void OnTriggerEnter2D(Collider2D localCollider2D)
 {
     if (target != null)
     {
         if (CanCollideWith(localCollider2D.gameObject))
         {
             MegamanController megamanController = GameObject.FindObjectOfType <MegamanController>();
             megamanController.CaptureBy(damageSourceOwner);
             EnemyIntroStageVile vile = damageSourceOwner.GetComponent <EnemyIntroStageVile>();
             vile.OnCaptureMegaman();
             Destroy(gameObject);
         }
     }
 }
 void Explode()
 {
     Collider2D[] allColliders = Physics2D.OverlapCircleAll(transform.position, explosionRadius);
     foreach (Collider2D collider2D in allColliders)
     {
         MegamanController megamanController = collider2D.gameObject.GetComponent <MegamanController>();
         if (megamanController != null)
         {
             Hitpoints hitpoints = megamanController.GetComponent <Hitpoints>();
             if (hitpoints != null)
             {
                 hitpoints.Damage(damage, gameObject, null);
             }
         }
     }
     Destroy(gameObject);
 }
Example #8
0
    protected bool ProximityCheckAgainstMegamanController(float radius, LayerMask layerMask)
    {
        bool success = false;

        Collider2D[] closeColliders = Physics2D.OverlapCircleAll(transform.position, radius, layerMask.value);

        foreach (Collider2D localCollider2D in closeColliders)
        {
            MegamanController megamanController = localCollider2D.gameObject.GetComponent <MegamanController>();
            if (megamanController != null)
            {
                success = true;
            }
        }

        return(success);
    }
Example #9
0
    void DropBomb(GameObject localGameObject, float force)
    {
        if (localGameObject != null)
        {
            if (canDropBomb)
            {
                canDropBomb = false;
                MegamanController megaman = localGameObject.GetComponent <MegamanController> ();

                if (megaman != null)
                {
                    GameObject  bombInstance  = Instantiate(bombBullet, bombBullet.transform.position, bombBullet.transform.rotation) as GameObject;
                    Vector3     moveVector    = localGameObject.transform.position - bombInstance.transform.position;
                    Rigidbody2D bombRigidbody = bombInstance.GetComponent <Rigidbody2D>();
                    bombInstance.SetActive(true);
                    bombRigidbody.AddForce(new Vector2(moveVector.x, moveVector.y) * force);
                }
            }
        }
    }
Example #10
0
    IEnumerator AttackRoutine()
    {
        MegamanController megamanController = null;

        while (true)
        {
            RaycastHit2D[] allHits = Physics2D.RaycastAll(transform.position, targetPosition.localPosition, 5f, megamanLayer.value);
            foreach (RaycastHit2D localHit2D in allHits)
            {
                megamanController = localHit2D.collider.gameObject.GetComponent <MegamanController>();
                if (megamanController != null)
                {
                    Hitpoints hitpoints = megamanController.gameObject.GetComponent <Hitpoints>();
                    hitpoints.Damage(damage, gameObject, gameObject);
                    break;
                }
            }
            yield return(new WaitForSeconds(0.5f));
        }
    }
Example #11
0
    void OnTriggerEnter2D(Collider2D localCollider2D)
    {
        MegamanController megamanController = localCollider2D.gameObject.GetComponent <MegamanController> ();

        if (megamanController != null)
        {
            Hitpoints hitpoints = megamanController.gameObject.GetComponent <Hitpoints>();
            hitpoints.Damage(damage, gameObject, gameObject);
            if (currentForm == 1)
            {
                if (!IsInvoking("RotateMeOnX"))
                {
                    Invoke("RotateMeOnX", 1.5f);
                }
                if (!IsInvoking("Fire"))
                {
                    Invoke("Fire", 2.0f);
                }
            }
        }
    }
 protected override void Awake()
 {
     base.Awake ();
     megamanController = GameObject.FindObjectOfType<MegamanController> ();
     myRigidbody2D = GetComponent<Rigidbody2D> ();
 }
Example #13
0
 void Awake()
 {
     megamanController = GetComponent<MegamanController> ();
 }
 void Awake()
 {
     megamanController = GameObject.FindObjectOfType<MegamanController> ();
 }
	void Awake()
	{
		megamanController = GameObject.FindObjectOfType<MegamanController> ();
	}
Example #16
0
 protected override void Awake()
 {
     base.Awake();
     megamanController = GameObject.FindObjectOfType <MegamanController> ();
     myRigidbody2D     = GetComponent <Rigidbody2D> ();
 }
Example #17
0
 protected virtual void Awake()
 {
     megamanController = GetComponent<MegamanController> ();
     startingEnergy = energy;
 }
Example #18
0
 protected override void Start()
 {
     base.Start();
     target            = GameObject.FindObjectOfType <MegamanController> ();
     moveTowardsPlayer = StartCoroutine(MoveTowardsPlayer());
 }
Example #19
0
 protected bool ProximityCheck(MegamanController megamanController, float distance)
 {
     return(Mathf.Abs(Vector3.Distance(transform.position, megamanController.transform.position)) <= distance);
 }
Example #20
0
 protected bool ProximityCheck(MegamanController megamanController, float distance)
 {
     return (Mathf.Abs (Vector3.Distance (transform.position, megamanController.transform.position)) <= distance);
 }
Example #21
0
 protected virtual void Awake()
 {
     megamanController = GetComponent <MegamanController> ();
     startingEnergy    = energy;
 }
Example #22
0
 void Awake()
 {
     megamanController = GetComponent <MegamanController> ();
 }
    public IEnumerator BeginCutscene()
    {
        megamanController = GameObject.FindObjectOfType<MegamanController> ();
        vile = GameObject.FindObjectOfType<EnemyIntroStageVile> ();
        deathRogumer = GameObject.FindObjectOfType<DeathRogumer> ();
        zeroController.gameObject.SetActive (true);
        zeroController.transform.position = new Vector3 (megamanController.transform.position.x - 4f, zeroController.transform.position.y, zeroController.transform.position.z);
        IntroStageCamera2DFollow camera2D = GameObject.FindObjectOfType<IntroStageCamera2DFollow> ();
        camera2D.enabled = false;
        bool loop = false;
        started = true;
        playing = true;

        VileTalks ();
        vilesDialog.gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        DisableDialogs ();
        chatbox.gameObject.SetActive (false);
        zeroController.Fire ();
        yield return new WaitForSeconds (0.7f);
        vile.BreakArm ();
        megamanController.myRigidbody2D.gravityScale = 1f;
        megamanController.EnableBentOnKneeAndHurt ();
        yield return new WaitForSeconds (1f);
        zeroController.Slide ();
        //Move zero
        loop = true;
        while(loop)
        {
            zeroController.transform.Translate (((megamanController.transform.position + Vector3.right * 2f) - zeroController.transform.position) * zeroController.speed * Time.deltaTime);
            if((zeroController.transform.position.x - megamanController.transform.position.x) > 0.6f && Vector3.Distance(zeroController.transform.position, megamanController.transform.position) < 0.8f)
            {
                zeroController.StopSliding();
                loop = false;
            }
            yield return new WaitForSeconds(Time.deltaTime);
        }
        //
        zeroController.Aim ();
        yield return new WaitForSeconds (1f);
        zeroController.StopAiming ();
        zeroController.Charge ();
        deathRogumer.transform.position = new Vector3 (vile.transform.position.x, deathRogumer.transform.position.y, deathRogumer.transform.position.z);
        deathRogumer.Deploy ();
        yield return new WaitForSeconds (1f);
        deathRogumer.DeployLift ();
        yield return new WaitForSeconds (1f);
        vile.jumpForce.y *= 2;
        vile.SetIgnoreLiftCollision (true);
        vile.JumpUp ();
        zeroController.StopCharging ();
        zeroController.Fire ();
        yield return new WaitForSeconds (0.5f);
        zeroController.LookUp ();
        vile.SetIgnoreLiftCollision (false);
        yield return new WaitForSeconds (0.5f);
        deathRogumer.ReadyToLeaveScene ();
        yield return new WaitForSeconds (1f);
        zeroController.transform.localScale = new Vector3 (zeroController.transform.localScale.x * -1, zeroController.transform.localScale.y, zeroController.transform.localScale.z);
        megamanController.transform.localScale = new Vector3 (1, megamanController.transform.localScale.y, megamanController.transform.localScale.z);
        yield return new WaitForSeconds (1f);
        MegamanTalks ();
        DisableDialogs ();
        megamansDialogs [0].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        ZeroTalks ();
        DisableDialogs ();
        zerosDialogs [0].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        ZeroTalks ();
        DisableDialogs ();
        zerosDialogs [1].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        ZeroTalks ();
        DisableDialogs ();
        zerosDialogs [2].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        ZeroTalks ();
        DisableDialogs ();
        zerosDialogs [3].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        ZeroTalks ();
        DisableDialogs ();
        zerosDialogs [4].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        ZeroTalks ();
        DisableDialogs ();
        zerosDialogs [5].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        ZeroTalks ();
        DisableDialogs ();
        zerosDialogs [6].gameObject.SetActive (true);
        yield return new WaitForSeconds (5f);
        chatbox.gameObject.SetActive (false);
        yield return new WaitForSeconds (1f);
        zeroController.Teleport ();
        yield return new WaitForSeconds (1f);
        megamanController.TeleportOut ();
        yield return null;
    }
Example #24
0
 protected override void Start()
 {
     base.Start ();
     target = GameObject.FindObjectOfType<MegamanController> ();
     moveTowardsPlayer = StartCoroutine (MoveTowardsPlayer ());
 }
    public IEnumerator BeginCutscene()
    {
        megamanController = GameObject.FindObjectOfType <MegamanController> ();
        vile         = GameObject.FindObjectOfType <EnemyIntroStageVile> ();
        deathRogumer = GameObject.FindObjectOfType <DeathRogumer> ();
        zeroController.gameObject.SetActive(true);
        zeroController.transform.position = new Vector3(megamanController.transform.position.x - 4f, zeroController.transform.position.y, zeroController.transform.position.z);
        IntroStageCamera2DFollow camera2D = GameObject.FindObjectOfType <IntroStageCamera2DFollow> ();

        camera2D.enabled = false;
        bool loop = false;

        started = true;
        playing = true;

        VileTalks();
        vilesDialog.gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        DisableDialogs();
        chatbox.gameObject.SetActive(false);
        zeroController.Fire();
        yield return(new WaitForSeconds(0.7f));

        vile.BreakArm();
        megamanController.myRigidbody2D.gravityScale = 1f;
        megamanController.EnableBentOnKneeAndHurt();
        yield return(new WaitForSeconds(1f));

        zeroController.Slide();
        //Move zero
        loop = true;
        while (loop)
        {
            zeroController.transform.Translate(((megamanController.transform.position + Vector3.right * 2f) - zeroController.transform.position) * zeroController.speed * Time.deltaTime);
            if ((zeroController.transform.position.x - megamanController.transform.position.x) > 0.6f && Vector3.Distance(zeroController.transform.position, megamanController.transform.position) < 0.8f)
            {
                zeroController.StopSliding();
                loop = false;
            }
            yield return(new WaitForSeconds(Time.deltaTime));
        }
        //
        zeroController.Aim();
        yield return(new WaitForSeconds(1f));

        zeroController.StopAiming();
        zeroController.Charge();
        deathRogumer.transform.position = new Vector3(vile.transform.position.x, deathRogumer.transform.position.y, deathRogumer.transform.position.z);
        deathRogumer.Deploy();
        yield return(new WaitForSeconds(1f));

        deathRogumer.DeployLift();
        yield return(new WaitForSeconds(1f));

        vile.jumpForce.y *= 2;
        vile.SetIgnoreLiftCollision(true);
        vile.JumpUp();
        zeroController.StopCharging();
        zeroController.Fire();
        yield return(new WaitForSeconds(0.5f));

        zeroController.LookUp();
        vile.SetIgnoreLiftCollision(false);
        yield return(new WaitForSeconds(0.5f));

        deathRogumer.ReadyToLeaveScene();
        yield return(new WaitForSeconds(1f));

        zeroController.transform.localScale    = new Vector3(zeroController.transform.localScale.x * -1, zeroController.transform.localScale.y, zeroController.transform.localScale.z);
        megamanController.transform.localScale = new Vector3(1, megamanController.transform.localScale.y, megamanController.transform.localScale.z);
        yield return(new WaitForSeconds(1f));

        MegamanTalks();
        DisableDialogs();
        megamansDialogs [0].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        ZeroTalks();
        DisableDialogs();
        zerosDialogs [0].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        ZeroTalks();
        DisableDialogs();
        zerosDialogs [1].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        ZeroTalks();
        DisableDialogs();
        zerosDialogs [2].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        ZeroTalks();
        DisableDialogs();
        zerosDialogs [3].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        ZeroTalks();
        DisableDialogs();
        zerosDialogs [4].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        ZeroTalks();
        DisableDialogs();
        zerosDialogs [5].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        ZeroTalks();
        DisableDialogs();
        zerosDialogs [6].gameObject.SetActive(true);
        yield return(new WaitForSeconds(5f));

        chatbox.gameObject.SetActive(false);
        yield return(new WaitForSeconds(1f));

        zeroController.Teleport();
        yield return(new WaitForSeconds(1f));

        megamanController.TeleportOut();
        yield return(null);
    }