Ejemplo n.º 1
0
    public static OrbMechanic GetOrbMechanic(OrbType type, OrbBehavior origin)
    {
        switch (type)
        {
        case OrbType.Test:
            return(new TestMechanic());

        case OrbType.Light:
            return(new LightMechanic());

        case OrbType.GravityRight:
            return(new GravityMechanic(1, origin.gravityParticles));

        case OrbType.GravityUp:
            return(new GravityMechanic(2, origin.gravityParticles));

        case OrbType.GravityLeft:
            return(new GravityMechanic(3, origin.gravityParticles));

        case OrbType.Dash:
            return(new DashMechanic(origin.dashAnchor, origin.dashArrow, origin.dashField));

        case OrbType.Projectile:
            return(new ProjectileMechanic(origin.projectile));

        case OrbType.Pull:
            return(new PullMechanic(origin.hook));

        case OrbType.DoubleJump:
            return(new DoubleJumpMechanic());

        default:
            return(new OrbMechanic());
        }
    }
Ejemplo n.º 2
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        if (clickedOn)
        {
            GameObject hitOrb = collision.gameObject;
            if (hitOrb.tag == "Orb")
            {
                //Swap Grid Value (GameObject)
                int x, y;
                script.GetOrbGridXY(transform.position, out x, out y);

                int otherx, othery;
                script.GetOrbGridXY(hitOrb.transform.position, out otherx, out othery);

                GameObject tempValue = script.orbGrid[x, y].gameObject;
                script.setOrbGridValue(x, y, hitOrb);
                script.setOrbGridValue(otherx, othery, tempValue);
                //Swap Orb positions
                Vector3     tempPos      = hitOrb.GetComponent <OrbBehavior>().GetOriginalPosition();
                OrbBehavior hitOrbScript = hitOrb.GetComponent <OrbBehavior>();
                hitOrbScript.SetOriginalPosition(originalPosition);
                originalPosition          = tempPos;
                hitOrb.transform.position = Vector2.Lerp(hitOrb.transform.position, originalPosition, snapSpeed);


                swapedPostion = true;
                hitOrbScript.setSwapBool(true);
            }
        }
    }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     game          = GameObject.FindGameObjectWithTag("Manager").GetComponent <GameBehavior>();
     thisRigidbody = this.GetComponent <Rigidbody2D>();
     sr            = gameObject.GetComponent <SpriteRenderer>();
     orb           = Instantiate(orbPrefab);
     orbScript     = orb.GetComponent <OrbBehavior>();
     orb.SetActive(false);
 }
Ejemplo n.º 4
0
 public override void onOrbAdd(OrbBehavior orb)
 {
     changeState(orb.type, true);
     if (this.tag.Equals("Last Pedestral")) //TAG IN FINAL LAST LEVEL THAT PEDESTRAL AS LAST ONE TO STOP THE TIMER
     {
         if (timer != null)
         {
             timer.stop();
         }
     }
 }
Ejemplo n.º 5
0
    // Start is called before the first frame update
    void Start()
    {
        isShifting = false;

        grid = new Grid <int>(gridWidth, gridHeight, cellSize);

        orbGrid = new GameObject[gridWidth, gridHeight];

        for (int x = 0; x < gridWidth; x++)
        {
            for (int y = 0; y < gridHeight; y++)
            {
                grid.SetValue(x, y, Random.Range(0, 5));
                int        gridIcon = grid.GetValue(x, y);
                GameObject newOrb   = null;
                newOrb = Instantiate(Orb, new Vector3(x * cellSize + cellSize * 0.5f, y * cellSize + cellSize * 0.5f), new Quaternion(0f, 0f, 0f, 0f));
                newOrb.gameObject.name = ((OrbTypes)gridIcon).ToString();
                OrbBehavior orbScript = newOrb.GetComponent <OrbBehavior>();
                orbScript.OrbType       = (OrbTypes)gridIcon;
                orbGrid[x, y]           = newOrb;
                newOrb.transform.parent = transform;
            }
        }
    }
Ejemplo n.º 6
0
 public override void onOrbRemove(OrbBehavior orb)
 {
     changeState(orb.type, false);
 }
 public virtual void onOrbRemove(OrbBehavior orb)
 {
 }
 public virtual void onOrbAdd(OrbBehavior orb)
 {
 }