Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        audioSFX         = GetComponents <AudioSource> ();
        jumpTimeCheck    = 0;
        lastColliders    = new List <Collider2D> ();
        thisParent       = transform.parent.gameObject;
        leftBottomScreen = Camera.main.ScreenToWorldPoint(new Vector2(0, 0));
        rightTopScreen   = Camera.main.ScreenToWorldPoint(new Vector2(Screen.width, Screen.height));

        prevScreenWidth = Screen.width;

        thisBody     = GetComponent <Rigidbody2D> ();
        thisCollider = GetComponent <Collider2D> ();

        canJump = 0;

        baseParent = transform.parent;

        movSpeedX = 0;
        movSpeedY = 0;

        state = "normal";

        arrow     = transform.GetChild(1).Find("arrow").gameObject;
        rock      = transform.GetChild(1).Find("rock").gameObject;
        explosion = transform.GetChild(1).Find("fireExplosion").gameObject;

        characterAnimScript = transform.GetChild(1).GetComponent <Anim_GlobalControl> ();
        characterAnimator   = transform.GetChild(1).GetComponent <Animator> ();

        ropeAnimator = transform.GetChild(2).GetComponent <Animator> ();

        if (globalScript.previousScene != "")
        {
            GameObject spawnPoints = GameObject.Find("spawnPoints");
            if (spawnPoints != null)
            {
                for (int i = 0; i < spawnPoints.transform.childCount; i++)
                {
                    GameObject c = spawnPoints.transform.GetChild(i).gameObject;
                    if (c.name == globalScript.previousScene)
                    {
                        transform.position = c.transform.position;
                        GameObject orient = c.transform.GetChild(0).gameObject;
                        if (orient.name == "back")
                        {
                            characterAnimScript.flip = true;
                        }
                        break;
                    }
                }
            }
        }

        keepCameraOnCharacter(true);
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        platformWaitTime    = 0;
        highestSortingOrder = -9999;
        findSpritesRecursive(transform);
        highestSortingOrder++;
        globalScript.startingOrderEnemies = highestSortingOrder;

        basePosition      = transform.localPosition;
        thisAnimator      = transform.GetChild(0).GetComponent <Animator> ();
        thisBody          = GetComponent <Rigidbody2D> ();
        thisPuppetControl = transform.GetChild(0).GetComponent <Anim_GlobalControl> ();

        state = "normal";

        if (transform.name == "snail")
        {
            attackDuration  = 1.6f;
            life            = 1;
            attackDelayTime = 1;
            attackPoints    = 10;
            awardedCoins    = 5;
        }
        else if (transform.name == "slime")
        {
            attackDuration  = 1;
            life            = 2;
            attackDelayTime = 0;
            attackPoints    = 12;
            awardedCoins    = 5;
        }
        else if (transform.name == "leaf")
        {
            attackDuration  = 1;
            life            = 1;
            attackDelayTime = 0;
            attackPoints    = 18;
            awardedCoins    = 5;
        }
        else if (transform.name == "spike")
        {
            attackDuration  = 2.55f;
            life            = 1;
            attackDelayTime = 0;
            attackPoints    = 15;
            awardedCoins    = 5;
        }
        else if (transform.name == "armadillo")
        {
            attackDuration  = 1.5f;
            life            = 2;
            attackDelayTime = 1;
            attackPoints    = 20;
            awardedCoins    = 5;
        }
        else if (transform.name == "caterpillar")
        {
            attackDuration  = 1.5f;
            life            = 2;
            attackDelayTime = 0.2f;
            attackPoints    = 20;
            awardedCoins    = 5;
        }
        else if (transform.name == "cactus")
        {
            attackDuration  = 1.5f;
            life            = 2;
            attackDelayTime = 0.2f;
            attackPoints    = 20;
            awardedCoins    = 5;
        }
        else if (transform.name == "spider")
        {
            attackDuration  = 1.5f;
            life            = 2;
            attackDelayTime = 0.2f;
            attackPoints    = 20;
            awardedCoins    = 5;
        }
        else if (transform.name == "fluff")
        {
            attackDuration  = 1.3f;
            life            = 3;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 5;
        }
        else if (transform.name == "octopus")
        {
            attackDuration  = 1.3f;
            life            = 3;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 5;
        }
        else if (transform.name == "bee")
        {
            attackDuration  = 1.3f;
            life            = 3;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 5;
        }
        else if (transform.name == "spikey")
        {
            attackDuration  = 1.3f;
            life            = 3;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 5;
        }
        else if (transform.name == "darkOctopus")
        {
            attackDuration  = 1.3f;
            life            = 5;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 10;
        }
        else if (transform.name == "darkSpikey")
        {
            attackDuration  = 1.3f;
            life            = 5;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 10;
        }
        else if (transform.name == "darkBee")
        {
            attackDuration  = 1.3f;
            life            = 5;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 10;
        }
        else if (transform.name == "darkFluff")
        {
            attackDuration  = 1.3f;
            life            = 5;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 10;
        }
        else if (transform.name == "darkArmadillo")
        {
            attackDuration  = 1.3f;
            life            = 5;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 10;
        }
        else if (transform.name == "darkCaterpillar")
        {
            attackDuration  = 1.3f;
            life            = 5;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 10;
        }
        else if (transform.name == "darkCactus")
        {
            attackDuration  = 1.3f;
            life            = 5;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 10;
        }
        else if (transform.name == "darkSpider")
        {
            attackDuration  = 1.3f;
            life            = 5;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 10;
        }
        else if (transform.name == "darkSpike")
        {
            attackDuration  = 1.3f;
            life            = 5;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 10;
        }
        else if (transform.name == "darkSlime")
        {
            attackDuration  = 1.3f;
            life            = 5;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 10;
        }
        else if (transform.name == "darkLeaf")
        {
            attackDuration  = 1.3f;
            life            = 5;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 10;
        }
        else if (transform.name == "darkSnail")
        {
            attackDuration  = 1.3f;
            life            = 5;
            attackDelayTime = 0.2f;
            attackPoints    = 30;
            awardedCoins    = 10;
        }

        if (movSpeedX > 0)
        {
            changeFaceDirection(true);
        }

        multiTaskTimer = 0;
    }