Ejemplo n.º 1
0
 public void Die(bool effect = false)
 {
     if (gameObject.name.Contains("Exploder1Mole"))
     {
         ExplosionLine line       = null;
         Transform     explosionX = (Transform)Instantiate(exploderX, transform.position, transform.rotation);
         line         = explosionX.gameObject.GetComponent <ExplosionLine>();
         line.expandY = false;
         line.posX    = posX;
         line.posY    = posY;;
         Transform explosionY = (Transform)Instantiate(exploderY, transform.position, transform.rotation);
         line         = explosionY.gameObject.GetComponent <ExplosionLine>();
         line.expandY = true;
         line.posX    = posX;
         line.posY    = posY;
     }
     else if (gameObject.name.Contains("Exploder2Mole"))
     {
         Transform     exTransform = (Transform)Instantiate(exploderGrid, transform.position, transform.rotation);
         ExplosionGrid explosion   = exTransform.gameObject.GetComponent <ExplosionGrid>();
         explosion.posX = posX;
         explosion.posY = posY;
     }
     else if (gameObject.name.Contains("FreezeMole"))
     {
         GameObject ice = Instantiate(iceLayer, new Vector3(0, 10, 0), Quaternion.identity) as GameObject;
     }
     ((Player)player.gameObject.GetComponent(typeof(Player))).IncreaseScore(score);
     Destroy(gameObject);
 }
Ejemplo n.º 2
0
        static void UpdateExplosionLines()
        {
            foreach (LinkedListNode <ExplosionLine> explosionLine in m_preallocatedExplosionLines)
            {
                explosionLine.Value.ActualTime += MyConstants.PHYSICS_STEP_SIZE_IN_MILLISECONDS;
                if (explosionLine.Value.ActualTime > explosionLine.Value.TotalTime)
                {
                    m_preallocatedExplosionLines.MarkForDeallocate(explosionLine);
                    continue;
                }

                explosionLine.Value.ActualDir = Vector3.Lerp(explosionLine.Value.StartDir, explosionLine.Value.EndDir, explosionLine.Value.ActualTime / (float)explosionLine.Value.TotalTime);
            }

            m_preallocatedExplosionLines.DeallocateAllMarked();
            if (m_State == NuclearState.FADE_IN && MyMwcUtils.GetRandomFloat(0, 1) > 0.75f)
            {
                ExplosionLine line = m_preallocatedExplosionLines.Allocate(true);
                if (line != null)
                {
                    line.TotalTime  = 5000;
                    line.ActualTime = 0;
                    line.StartDir   = MyMwcUtils.GetRandomVector3Normalized();

                    Vector3 rotDir    = MyMwcUtils.GetRandomVector3Normalized();
                    Matrix  rotMatrix = Matrix.CreateFromAxisAngle(rotDir, 0.3f);
                    line.EndDir = Vector3.Transform(line.StartDir, rotMatrix);
                }
            }
        }
Ejemplo n.º 3
0
 void Start()
 {
     lines = GetComponent<LineRenderManager>();
     points = new ExplosionPoint[maxPoints];
     for(int i=0;i<points.Length;i++){
         points[i] = new ExplosionPoint();
     }
     elines = new ExplosionLine[maxLines];
     for(int i=0;i<elines.Length;i++){
         elines[i] = new ExplosionLine();
     }
 }
Ejemplo n.º 4
0
    public override void OnDeath()
    {
        GameObject exploder = Resources.Load <GameObject>("Prefabs/ExplosionLine");

        ExplosionLine line       = null;
        GameObject    explosionX = Instantiate(exploder, transform.position, transform.rotation) as GameObject;

        line         = explosionX.GetComponent <ExplosionLine>();
        line.expandY = false;
        line.posX    = posX;
        line.posY    = posY;
        GameObject explosionY = Instantiate(exploder, transform.position, transform.rotation) as GameObject;

        line         = explosionY.GetComponent <ExplosionLine>();
        line.expandY = true;
        line.posX    = posX;
        line.posY    = posY;


        base.OnDeath();
    }