Esempio n. 1
0
 // Start is called before the first frame update
 void Start()
 {
     plantRenderer    = GetComponent <SkinnedMeshRenderer>();
     gliderController = GetComponent <GliderController>();
     thisGO           = this.gameObject;
     flyingStates     = GetComponent <FlyingStates>();
 }
Esempio n. 2
0
 // Start is called before the first frame update
 void Start()
 {
     stateMachineAnimation = GetComponent <StateMachineAnimation>();
     rotationController    = GetComponent <RotationController>();
     flyingStates          = GetComponent <FlyingStates>();
     gliderController      = GetComponent <GliderController>();
 }
Esempio n. 3
0
    // public LightScript lightScript;

    //Start
    private void Start()
    {
        //zone1.SetActive(true);
        //zone2.SetActive(false);

        inUpDraft = false;
        audio     = FindObjectOfType <AudioManager>();

        creditsMenu = GameObject.Find("Credits Menu");
        creditsMenu.SetActive(false);

        //Calling Scripts
        debugLines         = GetComponent <DebugLines>();
        flyingStates       = GetComponent <FlyingStates>();
        playerCollider     = GetComponent <BoxCollider>();
        camFollow          = GetComponent <CamFollow>();
        input              = GetComponent <InputManager>();
        rotationController = GetComponent <RotationController>();
        animationScript    = GetComponent <AnimationScript>();
        loadLevel          = GetComponent <LoadLevel>();
        // lightScript.light.color = lightScript.Cavecolor;

        //boostLight.SetActive(false);
        //windStream.SetActive(false);
        flyingStates.WingStreamsOff();
        FindObjectOfType <AudioManager>().StopPlayingAudio("Boost");


        EndGameUI.SetActive(false);
    }
Esempio n. 4
0
 // Start is called before the first frame update
 void Start()
 {
     hitbox.SetActive(false);
     audio          = GetComponent <AudioSource>();
     rb             = gameObject.GetComponent <Rigidbody2D>();
     states         = FlyingStates.IDLE;
     isDead         = false;
     facingLeft     = true;
     isFalling      = true;
     flyHeight      = Random.Range(2f, 5.0f);
     colbox.enabled = true;
 }
Esempio n. 5
0
 public void flyAttack(Collider2D collision)
 {
     if (collision.tag == "Player" && !inAttack)
     {
         if (collision.transform.position.x > gameObject.transform.position.x)
         {
             Vector2 theScale = transform.localScale;
             theScale.x          *= -1;
             facingLeft           = !facingLeft;
             transform.localScale = theScale;
         }
         inAttack = true;
         states   = FlyingStates.BLADEF;
         StartCoroutine(melee());
     }
 }
Esempio n. 6
0
    // Start is called before the first frame update
    void Start()
    {
        FindObjectOfType <MenuController>();
        canRollLeft        = true;
        canRollRight       = true;
        animationScript    = GetComponent <AnimationScript>();
        rotationController = GetComponent <RotationController>();
        flyingStates       = GetComponent <FlyingStates>();
        gliderController   = GetComponent <GliderController>();
        audioManager       = GetComponent <AudioManager>();

        if (FindObjectOfType <MenuController>().controlsInverted == true)
        {
            playerControlsInverted = true;
        }
        else if (FindObjectOfType <MenuController>().controlsInverted == false)
        {
            playerControlsInverted = false;
        }
    }
Esempio n. 7
0
    IEnumerator fire()
    {
        states   = FlyingStates.GUN;
        inAttack = true;
        flyAn.SetTrigger("GunAttack");
        yield return(new WaitForSeconds(0.30f));

        for (int i = 0; i < 2; i++)
        {
            Factory(projectile, spawnPoint.transform.position, spawnPoint.transform.rotation, controller);
            audio.Play();
            yield return(new WaitForSeconds(0.10f));
        }
        yield return(new WaitForSeconds(0.30f));

        states = FlyingStates.IDLE;
        flyAn.ResetTrigger("GunAttack");
        inAttack = false;
        yield return(null);
    }
Esempio n. 8
0
    // Update is called once per frame
    void FixedUpdate()
    {
        //We get the drone position to reflect it on the screen
        ServerMessages.IPSFrameData frameData = DroneModule.DequeueIPSDronFrame();
        if (frameData != null)
        {
            drone.transform.position = frameData.position;
            drone.transform.rotation = Quaternion.Euler(frameData.rotation);
            //Camera.main.transform.position = new Vector3(drone.transform.position.x, drone.transform.position.y + 10, drone.transform.position.z) ;
        }
        //We get the anchors to paint them
        ServerMessages.IPSFrameAnchorData anchorData = PozyxModule.DequeueIPSAnchorFrame();
        if (anchorData != null)
        {
            anchorParent.transform.Find("Anchor" + anchorID).position = anchorData.position;
            anchorID++;
            if (anchorID == 9)
            {
                UnityEngine.Debug.Log("All anchors positioned");
            }
        }
        //Here we should do a takeoff
        switch (states)
        {
        case FlyingStates.IDLE:
            break;

        case FlyingStates.STARTFLYING:
            time += Time.deltaTime;
            if (time >= 2.0f)
            {
                clientUnity.client.SendCommand((byte)Modules.PLAN_EXECUTOR_MODULE, (byte)PlanExecutorCommandType.PLAN_EXEC_TAKEOFF);


                states = FlyingStates.FLYING;
            }
            break;

        case FlyingStates.FLYING:

            break;

        default:
            break;
        }
        //If the drone reached its destination, we activate the button that returns to general
        if (flightEnded)
        {
            flightEnded = false;
            droneHasFinishedPanel.gameObject.SetActive(true);
            warningRecStartPanel.gameObject.SetActive(false);
            recordingPanel.gameObject.SetActive(false);
        }

        /*
         * if (indexWaypoints >= waypoints.Count || TotalindexMiddlePoints >= path.middlePointsTop.Count)
         * {
         *  active = false;
         *
         * }
         * if (active && time < 1)
         * {
         *  drone.transform.position = Vector3.Lerp(actualWaypoint, nextWaypoint, time);
         *  //camToTravel.transform.position = nextWaypoint * Time.deltaTime * 0.001f;
         *  if (waypoints[indexWaypoints].GetComponent<PathPoint>().BlockDirection)
         *  {
         *      drone.transform.rotation = Quaternion.Euler(waypoints[indexWaypoints].GetComponent<PathPoint>().GimbalRotation.z, waypoints[indexWaypoints].GetComponent<PathPoint>().GimbalRotation.y - 90, waypoints[indexWaypoints].GetComponent<PathPoint>().GimbalRotation.x);
         *      //blockedDIrection = true;
         *  }
         *  else if (!waypoints[indexWaypoints].GetComponent<PathPoint>().BlockDirection)
         *  {
         *      drone.transform.LookAt(waypoints[indexWaypoints].GetComponent<PathPoint>().Poi);
         *  }
         *
         *  time += Time.deltaTime;
         * }
         * if (active && time >= 1)
         * {
         *  actualWaypoint = nextWaypoint;
         *  UnityEngine.Debug.Log(waypoints[indexWaypoints].GetComponent<PathPoint>().Segments);
         *  if (waypoints[indexWaypoints].GetComponent<PathPoint>().Segments <= 3)
         *  {
         *      if (waypoints.Count - 1 > indexWaypoints)
         *      {
         *          indexWaypoints++;
         *          TotalindexMiddlePoints++;
         *          nextWaypoint = waypoints[indexWaypoints].transform.position;
         *          indexMiddlePoints = 0;
         *      }
         *      //blockedDIrection = false;
         *
         *  }
         *  else
         *  {
         *      if (waypoints[indexWaypoints].GetComponent<PathPoint>().Segments == indexMiddlePoints + 1)
         *      {
         *          indexWaypoints++;
         *          TotalindexMiddlePoints++;
         *          if (TotalindexMiddlePoints < path.middlePointsTop.Count)
         *              nextWaypoint = path.middlePointsTop[TotalindexMiddlePoints];
         *          indexMiddlePoints = 0;
         *          //blockedDIrection = false;
         *
         *      }
         *      else if (path.middlePointsTop.Count > TotalindexMiddlePoints)
         *      {
         *          indexMiddlePoints++;
         *          TotalindexMiddlePoints++;
         *          if (TotalindexMiddlePoints < path.middlePointsTop.Count)
         *              nextWaypoint = path.middlePointsTop[TotalindexMiddlePoints];
         *      }
         *  }
         *
         *
         *  time = 0;
         * }
         */
    }
Esempio n. 9
0
 // Start is called before the first frame update
 void Start()
 {
     flyingStates = GetComponent <FlyingStates>();
 }
Esempio n. 10
0
 void Start()
 {
     flyingStates = GetComponent <FlyingStates>();
     input        = GetComponent <InputManager>();
 }
Esempio n. 11
0
    // Update is called once per frame
    void FixedUpdate()
    {
        timer -= Time.deltaTime;
        if (!isDead)
        {
            if (states == FlyingStates.MOVING)
            {
                rb.velocity = new Vector2(0.5f, rb.velocity.y);
            }
            if (states == FlyingStates.GUN)
            {
            }
            if (states == FlyingStates.BLADEF)
            {
                rb.velocity = new Vector2(-0.5f, -2f);
                if (gameObject.transform.position.y < lowpoint.transform.position.y)
                {
                    states = FlyingStates.BLADER;
                }
            }
            if (states == FlyingStates.BLADER)
            {
                rb.velocity = new Vector2(-0.5f, 2f);

                if (gameObject.transform.position.y > lowpoint.transform.position.y)
                {
                    states = FlyingStates.IDLE;
                }
            }
            if (transform.position.y - ground.transform.position.y < flyHeight && isFalling)
            {
                rb.velocity = new Vector2(rb.velocity.x, 0.5f);
            }

            if (timer < 0 && inAttack != true)
            {
                if (states == FlyingStates.GUN)
                {
                    timer = 5.0f;
                    flyAn.SetInteger("MoveState", 0);
                    Debug.Log("Changing States");
                    states = FlyingStates.IDLE;
                }
                else if (states == FlyingStates.IDLE)
                {
                    timer = 5.0f;
                    flyAn.SetInteger("MoveState", 1);
                    Debug.Log("Changing States");
                    states = FlyingStates.MOVING;
                    Vector2 theScale = transform.localScale;
                    theScale.x          *= -1;
                    facingLeft           = !facingLeft;
                    transform.localScale = theScale;
                }
                else if (states == FlyingStates.MOVING)
                {
                    timer = 3.0f;
                    StartCoroutine(fire());
                }
            }
        }
    }
Esempio n. 12
0
 // Start is called before the first frame update
 void Start()
 {
     gliderController = GetComponent <GliderController>();
     //lookAtTransform.transform.position = new Vector3(lookAtOffsetX, lookAtOffsetY, lookAtOffsetZ);
     flyingStates = GetComponent <FlyingStates>();
 }