Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        wind               = GameObject.FindGameObjectWithTag("cannons").GetComponent <windBehaviour>();
        windSpeed          = 0;
        posX               = Random.Range(1f, 9f);
        transform.position = new Vector3(posX, posY, 0);
        Velocity.x         = 0;
        Velocity.y         = 0;
        points             = new Transform[19];
        lines              = new LineRenderer[18];
        currentPos         = new Vector3[19];
        previousPos        = new Vector3[19];
        lengthConstraints  = new float[19];
        lengthTolerance    = 0.005f;
        angleConstraints   = new float[19];
        angleTolerance     = 0.01f;
        velX               = new float[19]; //this does not store velocity, rather it is just used to calculate inertia for each point
        velY               = new float[19];
        head               = transform.Find("Head");
        body               = transform.Find("Body");

        draw(true);
        buildConstraints();

        float dir = Random.Range(-1f, 1f);

        if (dir < 0)
        {
            flipTurkey(-1);
        }

        int jump = Random.Range(1, 14);

        InvokeRepeating("Jump", jump, 7f);
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        transform.position = new Vector3(InitPosX, InitPosY, 0);
        wind  = GameObject.FindGameObjectWithTag("cannons").GetComponent <windBehaviour>();
        angle = GameObject.FindGameObjectWithTag("cannons").GetComponent <cannonBehaviour>().getCannonAngle(); //find firing angle

        // compute mountain slope
        rightSlope = (rightBot.y - rightTop.y) / (rightBot.x - rightTop.x);
        leftSlope  = (leftBot.y - leftTop.y) / (leftBot.x - leftTop.x);

        //set appropriate initial velocity
        Velocity.x = -initialVelocity *Mathf.Cos(Mathf.Deg2Rad *angle);

        Velocity.y = initialVelocity * Mathf.Sin(Mathf.Deg2Rad * angle);

        turkeyManager = GameObject.Find("TurkeyManager").GetComponent <turkeyManager>();
        turkeyList    = turkeyManager.turkeyList;
    }
Exemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     wind = GameObject.FindGameObjectWithTag("cannons").GetComponent <windBehaviour>();
 }