Beispiel #1
0
    // Use this for initialization
    void Start () {
        sprite = GetComponent<SpriteRenderer>();
        scr_ObjectFactory = GameObject.FindGameObjectWithTag("ObjectFactory").GetComponent<objectFactory>();
        collidingManList = new List<GameObject>();
        fallDirection = new Vector3(0, -fallSpeed, 0);

    }
Beispiel #2
0
    // Use this for initialization
    void Awake() {
        scr_ObjectFactory = GameObject.FindGameObjectWithTag("ObjectFactory").GetComponent<objectFactory>();

        scoreText = GameObject.FindGameObjectWithTag("scoreText").GetComponent<ScoreManager>();
        passedTop = false;
        rotation = new Vector3(0, 0, 0);
        blueClimbRotation = new Vector3(0, 0, 0);
        redClimbRotation = new Vector3(0, 0, 0);
        isGrounded = true;
        allowFalling = true;
        colTrggerCount = 0;
        redDirectionValue = runningSpeed;
        blueDirectionValue = -runningSpeed;
        running = new Vector3(runningSpeed,0.0f);
        runningSlope = new Vector3(slopeRunningSpeed, slopeRunningSpeed);
        climbing = new Vector3(0.0f, climbingSpeed);
        falling = new Vector3(0.0f, -climbingSpeed);
        currentState = manState.Running;
        //directionValue = 10.0f;

        //frontCollider = Instantiate(objectFactory.pdf_ManMiniCollider) as GameObject;
        //frontCollider.GetComponent<BoxCollider2D>().isTrigger = true;
        //frontCollider.GetComponent<scr_manMiniCollider>().Initialize(this.gameObject);
        groundCollider = Instantiate(scr_ObjectFactory.pdf_ManGroundCollider) as GameObject;
        groundCollider.GetComponent<scr_manGroundCollider>().Initialize(this.gameObject);


        backCollider = Instantiate(scr_ObjectFactory.pdf_ManMiniCollider) as GameObject;
        backCollider.GetComponent<scr_manMiniCollider>().Initialize(this.gameObject);


        manRenderer = GetComponent<Renderer>();
    }
    public GenericObject(bool stg, bool uro, float d, float s)
    {
        myObjFactory = new objectFactory();
        mainCam      = GameObject.FindWithTag("MainCamera");

        snapToGrid        = stg;
        useRotationOffset = uro;
        distance          = d;
        smooth            = s;
    }
    public GenericObject()
    {
        myObjFactory = new objectFactory();
        mainCam      = GameObject.FindWithTag("MainCamera");

        myObject          = null;
        snapToGrid        = false;
        useRotationOffset = false;
        distance          = 10;
        smooth            = 10;
    }
    // Use this for initialization
    void Start()
    {
        scr_ObjectFactory = GameObject.FindGameObjectWithTag("ObjectFactory").GetComponent<objectFactory>();

        lastFired = 0.0f;
        LastWasBlue = false;
        LastWasRed = false;

        redManStartPosition = new Vector3(951f, -130f);
        blueManStartPosition = new Vector3(-951f, -130f);

    }
Beispiel #6
0
    // Use this for initialization
    void Start () {
        allowFire = true;
        allowFireOverride = false;
        playGroundHitAnimation = false;

        scr_ObjectFactory = GameObject.FindGameObjectWithTag("ObjectFactory").GetComponent<objectFactory>();
        myDirtMagicScript = myDirtMagic.GetComponent<scr_DirtMagic>();

        myGroundHitScript = myGroundHit.GetComponent<scr_groundHit>();

        cannonDownRotation = new Vector3(0, 0, -downRotationSpeed);
        cannonUpRotation = new Vector3(0, 0, upRotationSpeed);

        speed = Configuration.PlayerSpeed;

        myCannonAudioSource = myCannon.GetComponent<AudioSource>();

        myCannonRotationSpeed = Configuration.CannonRotationSpeed;

        //myCog = scr_ObjectFactory.createCog();
        myCogScript = myCog.GetComponent<cogAniControl>();

        lastTimeGroundCreated = Time.fixedTime;

        switch (playerColour)
        {
            case Configuration.playerColourEnum.Red:
                //myCog.transform.position = new Vector3(myCannon.transform.position.x, myCannon.transform.position.y);
                //myCog.GetComponent<SpriteRenderer>().flipX = true;
                //myCog.transform.Rotate(new Vector3(0, 180, 0));
                myCannon.transform.Rotate(new Vector3(0, 180, 0));
                myCannonYDirection = 180.0f;
                break;
            case Configuration.playerColourEnum.Blue:
                //myCog.transform.position = new Vector3(myCannon.transform.position.x, myCannon.transform.position.y);
                myCannonYDirection = 0.0f;
                break;
            default:
                break;
        }

    }
Beispiel #7
0
 // Use this for initialization
 void Start()
 {
     blockLimit = Configuration.BlockLimit;
     blocks = new List<GameObject>();
     scr_ObjectFactory = GameObject.FindGameObjectWithTag("ObjectFactory").GetComponent<objectFactory>();
 }
Beispiel #8
0
    // Use this for initialization
    void Start () {
        scr_ObjectFactory = GameObject.FindGameObjectWithTag("ObjectFactory").GetComponent<objectFactory>();
        gridSize = new Vector2(64, 13);
        startPosition = new Vector2(-945f, -165f);
        gridOfGameObjects = new GameObject[(int)gridSize.x][];
        for (int x = 0; x < gridSize.x; x++)
        {
            
            gridOfGameObjects[x] = new GameObject[(int)gridSize.y];
            for (int y = 0; y < gridSize.y; y++)
            {
                GameObject go = Instantiate(scr_ObjectFactory.pfb_ground) as GameObject;
                Transform t = go.GetComponent<Transform>();
                SpriteRenderer sr = go.GetComponent<SpriteRenderer>();
                scr_ground scr = go.GetComponent<scr_ground>();
                t.position = new Vector3(startPosition.x + (x * sr.bounds.size.x), startPosition.y - ( y * sr.bounds.size.y));
                scr.position = new Vector2(x, y);
                scr.currentState = scr_ground.groundState.Static;
                gridOfGameObjects[x][y] = go;
                if(x >= 25 && x <= 38)
                {
                    scr.indestructible = true;
                }
                switch (y)
                {
                    case 0:
                        sr.sprite = A1;
                        scr.InitializeGroundHP = a_hp;
                        break;
                    case 1:
                        sr.sprite = A2;
                        scr.InitializeGroundHP = a_hp;
                        break;
                    case 2:
                        sr.sprite = B1;
                        scr.InitializeGroundHP = b_hp;
                        break;
                    case 3:
                        sr.sprite = B2;
                        scr.InitializeGroundHP = b_hp;
                        break;
                    case 4:
                        sr.sprite = B3;
                        scr.InitializeGroundHP = b_hp;
                        break;
                    case 5:
                        sr.sprite = B4;
                        scr.InitializeGroundHP = b_hp;
                        break;
                    case 6:
                        sr.sprite = C1;
                        scr.InitializeGroundHP = c_hp;
                        break;
                    case 7:
                        sr.sprite = C2;
                        scr.InitializeGroundHP = c_hp;

                        break;
                    case 8:
                        sr.sprite = C3;
                        scr.InitializeGroundHP = c_hp;

                        break;
                    case 9:
                        sr.sprite = R1;
                        scr.InitializeGroundHP = r_hp;
                        break;
                    case 10:
                        sr.sprite = R2;
                        scr.InitializeGroundHP = r_hp;
                        break;
                    case 11:
                        sr.sprite = R3;
                        scr.InitializeGroundHP = r_hp;
                        break;
                    case 12:
                        sr.sprite = null;
                        scr.indestructible = true;
                        scr.InitializeGroundHP = l_hp;
                        break;
                    default:
                        break;
                }

            }
        }
    }