예제 #1
0
    void FixedUpdate()
    {
        switch (enemyId)
        {
        case 8:
            //miscGameObject[0] = parentOwl (leave empty)
            //miscBool[0] = active
            //miscBool[1] = activeBuffer
            //miscBool[2] = exploded

            Rigidbody2D rb0 = gameObject.GetComponent <Rigidbody2D>();

            miscGameObject[0] = gameObject;
            miscGameObject[1] = transform.parent.gameObject;
            if (!miscGameObject[1].GetComponent <EnemyBehavior>().miscBool[0])
            {
                miscBool[2] = false;
            }
            if (!miscBool[2])
            {
                miscBool[0] = miscGameObject[1].GetComponent <EnemyBehavior>().miscBool[0];
            }
            else
            {
                miscBool[0] = false;
            }
            gameObject.GetComponent <Rigidbody2D>().isKinematic = !miscBool[0];
            if (!miscBool[1] && miscBool[0])
            {
                miscBool[2]        = false;
                transform.position = new Vector2(miscGameObject[1].transform.position.x, miscGameObject[1].transform.position.y - 2);
                miscBool[1]        = true;
            }
            else if (!miscBool[0])
            {
                miscBool[1]        = false;
                transform.position = new Vector2(-1000000, -1000000);
                gameObject.GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0);
            }
            playerFloorCollider a = gameObject.GetComponent <playerFloorCollider>();
            if (a.check[0] || a.check[1] || a.check[2])
            {
                miscBool[2] = true;
                miscGameObject[1].GetComponent <EnemyBehavior>().miscBool[0] = false;
            }

            if (rb0.velocity.y <= -40)
            {
                rb0.velocity = new Vector2(rb0.velocity.x, -40);
            }

            break;
        }
    }
예제 #2
0
    void Start()
    {
        pAngle = 0;

        sprinting = false;

        sL = GameObject.Find("CoreScripts").GetComponent <SceneLoader>();

        /*sPos = sL.shPos;
         * transform.position = sPos;*/

        pFC       = transform.Find("floorCollider").gameObject.GetComponent <playerFloorCollider>();
        rb        = gameObject.GetComponent <Rigidbody2D>();
        direction = 1;

        hC = transform.Find("hitCollider").gameObject.GetComponent <playerFloorCollider>();

        jumpMultiplier = 1;
        jumpTick       = 0;
        canJump        = true;
        multiJump      = 2;
        inJump         = false;

        aO.GetComponent <PlayerAttack>().SetPos(new Vector2(1000000.0f, 1000000.0f));
        canAttack = true;
        canPress  = true;

        LocalData.lD.hCounter = 2;
        canHurt = true;

        mCamera = GameObject.Find("Main Camera");

        inBonus       = false;
        bonusHealth   = 2;
        bonusComplete = false;
    }