Example #1
0
 private void Awake()
 {
     Instance = this;
     Client.Instance.addReadyListener(init);
     startSprite.gameObject.SetActive(false);
     fingerSprite.gameObject.SetActive(false);
 }
    void Start()
    {
        RotationController.CalibratedRotation().Add(this);

        scoreTextObject.transform.position = new Vector3(0, lvlGenerationTunnelHeight, 10);

        lvlGenerationGameObjects = new List <GameObject>();
        lvlGenerationCurrent     = -lvlGenerationBackwards;
        transform.position       = new Vector3(0.0f, 2.0f, 0.0f);
        transform.eulerAngles    = Vector3.up;
        score = 0;
        UpdateScoreDisplay();
        Mesh mesh = new Mesh();

        {
            mesh.vertices = new Vector3[] {
                new Vector3(-lvlGenerationTunnelWidth, 0, 0),
                new Vector3(-lvlGenerationTunnelWidth, 0, lvlGenerationMeshDistance),
                new Vector3(lvlGenerationTunnelWidth, 0, lvlGenerationMeshDistance),
                new Vector3(lvlGenerationTunnelWidth, 0, 0)
            };
            mesh.triangles = new int[] {
                0, 1, 2,
                0, 2, 3
            };
            mesh.RecalculateNormals();
            mesh.RecalculateBounds();
            mesh.Optimize();
        }
        lvlGenerationTestMesh = mesh;
    }
Example #3
0
 private void Start()
 {
     CardState.LockCard = false;
     translation        = GetComponentInChildren <TranslationController>();
     rotation           = GetComponentInChildren <RotationController>();
     scale = GetComponentInChildren <ScaleController>();
 }
Example #4
0
 // Start is called before the first frame update
 void Start()
 {
     stateMachineAnimation = GetComponent <StateMachineAnimation>();
     rotationController    = GetComponent <RotationController>();
     flyingStates          = GetComponent <FlyingStates>();
     gliderController      = GetComponent <GliderController>();
 }
Example #5
0
 private void Update()
 {
     if (rotationToggle.isOn)
     {
         RotationController.Rotate(rotationSpeed, _tmpGameObject);
     }
 }
 void Start()
 {
     animator           = GetComponent <Animator>();
     rotationController = GetComponent <RotationController>();
     movementController = GetComponent <MovementController>();
     rb2d = GetComponent <Rigidbody2D>();
 }
Example #7
0
 public void InitControllers()
 {
     if (rotationController == null)
     {
         rotationController = rotationControllerObject.GetComponent <RotationController>();
     }
 }
Example #8
0
 private void RotateSelectedGameObject()
 {
     if (unityObject != null)
     {
         RotationController.Rotate180Degrees(unityObject);
     }
 }
Example #9
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);
    }
 private void Awake()
 {
     _rotationController  = FindObjectOfType <RotationController>();
     _eatingController    = FindObjectOfType <EatingBugsController>();
     _particlesController = FindObjectOfType <ParticlesController>();
     _frozenEffect        = FindObjectOfType <FrozenEffect>();
     _enemyEffects        = FindObjectOfType <EnemyEffects>();
 }
 private static RotationController Controller()
 {
     if (sController == null)
     {
         sController = GameObject().GetComponent <RotationController>();
     }
     return(sController);
 }
Example #12
0
 public RotatePanel(Product p, DesignPanel dp)
 {
     product       = p;
     this.dp       = dp;
     originalImage = p.image;
     count         = 0;
     rc            = new RotationController(this);
     InitializeComponent();
 }
 /*****************************************************
 * AWAKE
 *
 * INFO:    Instance de la classe et rotation initiale.
 *
 *****************************************************/
 private void Awake()
 {
     //Initialise l'instance de cette classe
     if (instance == null)
     {
         instance = this;
     }
     //else { Destroy(this); }
 }
 /*****************************************************
 * DECREASE ANGLE
 *
 * INFO:    Diminue l'angle de rotation (swipe) lorsque
 *          l'utilisateur appui sur le bouton (-), puis
 *          met a jour la valeur affiché sur le label.
 *          L'angle minimum est de 10°.
 *
 *****************************************************/
 public void DecreaseAngle()
 {
     angleLabel = GameObject.FindWithTag("AngleLabel").GetComponent <TextMeshPro>();
     if (angle > 10f && angleLabel != null)
     {
         angle          -= incrRotation;
         angleLabel.text = angle.ToString() + "°";
         RotationController.GetInstance().SetAngle(angle);
     }
 }
Example #15
0
 void Start()
 {
     ch_controller      = GetComponent <CharacterController>();
     ch_animator        = GetComponent <Animator>();
     joystickController = GameObject.FindObjectOfType <JoystickController>();
     rotationController = GameObject.FindObjectOfType <RotationController>();
     fragsUI            = GameObject.FindGameObjectWithTag("Frags").GetComponent <Text>();
     fragsUI.text       = "Frags: " + frags.ToString();
     pHC = gameObject.GetComponent <PlayerHealthController>();
 }
 private void GetReferences()
 {
     controller         = GetComponent <AssignedController>();
     pushController     = GetComponentInChildren <PushController>();
     rotationController = GetComponent <RotationController>();
     player             = GetComponent <Player>();
     animator           = GetComponent <Animator>();
     rb2d        = GetComponent <Rigidbody2D>();
     playerAudio = GetComponent <PlayerAudio>();
 }
Example #17
0
        public Controller Step(Ball ball, float dt, float currentTime)
        {
            float   delta_t = ArrivalTime - currentTime;
            Vector3 A       = CalculateCourse(Car, Target, delta_t);

            Controller c = new Controller();

            Vector3 dir = Vector3.Normalize(A);

            if (doubleJump != null && !doubleJump.Finished)
            {
                c = doubleJump.Step();
            }
            else
            {
                Quaternion t;

                Vector3 predicted = Car.Position + Car.Velocity * delta_t + 0.5f * -650f * delta_t * delta_t * Vector3.UnitZ;

                if ((predicted - Target).Length() > 50)
                {
                    t = MathUtility.LookAt(dir, Car.Up);
                }
                else
                {
                    Vector3 d = ball.Position - Car.Position;
                    Vector3 r = new Vector3(d.Y, -d.X, 0);

                    t = MathUtility.LookAt(Vector3.Normalize(Vector3.Cross(d, r)), -Vector3.Normalize(d));
                }

                Vector3 inputs = RotationController.GetInputs(Car, t, dt);

                c.Roll  = inputs.X;
                c.Pitch = inputs.Y;
                c.Yaw   = inputs.Z;

                if (MathUtility.Angle(Car.Rotation, MathUtility.LookAt(dir, Car.Up)) < 0.4f)
                {
                    c.Boost = true;
                }

                if (Car.CanDodge)
                {
                    Finished = true;
                }
            }

            if (currentTime > ArrivalTime)
            {
                Finished = true;
            }

            return(c);
        }
Example #18
0
 private void GetReferences()
 {
     deathController         = GetComponent <DeathController>();
     movementController      = GetComponent <MovementController>();
     playerActionsController = GetComponent <PlayerActionsController>();
     respawnController       = GetComponent <RespawnController>();
     pushController          = GetComponentInChildren <PushController>();
     rotationController      = GetComponent <RotationController>();
     afterImageController    = GetComponent <AfterImageController>();
     animator = GetComponent <Animator>();
 }
Example #19
0
        public Controller Step(Ball ball, float dt, float currentTime)
        {
            Vector3 A = CalculateCourse(Car, Target, ArrivalTime - currentTime);

            Controller c = new Controller();

            Vector3 dir = Vector3.Normalize(A);

            if (doubleJump != null && !doubleJump.Finished)
            {
                c = doubleJump.Step();
            }
            else
            {
                Quaternion t;

                Car test = new Car(Car);

                for (int i = 0; i < (int)((ArrivalTime - currentTime) / 0.016667f); i++)
                {
                    test.Simulate(new Controller(), 0.016667f);
                }

                if ((Target - test.Position).Length() > 120)
                {
                    t = MathUtility.LookAt(dir, Car.Up);
                }
                else
                {
                    t = MathUtility.LookAt(Vector3.Normalize(ball.Position - Car.Position), Car.Up);
                }


                Vector3 inputs = RotationController.GetInputs(Car, t, dt);

                c.Roll  = inputs.X;
                c.Pitch = inputs.Y;
                c.Yaw   = inputs.Z;

                if (MathUtility.Angle(Car.Rotation, MathUtility.LookAt(dir, Car.Up)) < 0.4f)
                {
                    c.Boost = true;
                }
            }

            if (currentTime > ArrivalTime || A.Length() > 1050)
            {
                Finished = true;
            }

            return(c);
        }
Example #20
0
    private void Awake()
    {
        _weaponsContainer = GameObject.Find("/Core/Dropped Weapons").gameObject;
        colliders         = new List <Collider>();
        rigidbodies       = new List <Rigidbody>();

        _animator           = GetComponent <Animator>();
        _capsuleCollider    = GetComponent <CapsuleCollider>();
        _lineRenderer       = GetComponent <LineRenderer>();
        _rotationController = GetComponent <RotationController>();
        GetComponentsFromBodyParts();
        SwitchRagdollComponents();
    }
Example #21
0
    void Start()
    {
        m_PlayerActionState        = m_Player.GetComponent <ActionStateComponent>();
        m_PlayerRotationController = m_Player.GetComponent <RotationController>();

        m_TargetSelector = FindObjectOfType <TargetSelection>();
        var skillCallers = FindObjectsOfType <SkillCaller>();

        foreach (SkillCaller skillCaller in skillCallers)
        {
            skillCaller.SkillCalledEvent += SkillCalled;
        }
    }
Example #22
0
        public Controller Step(float dt)
        {
            Finished = car.HasWheelContact;

            Vector3 inputs = RotationController.GetInputs(car, targetRotation, dt);

            Controller controller = new Controller();

            controller.Roll  = inputs.X;
            controller.Pitch = inputs.Y;
            controller.Yaw   = inputs.Z;

            return(controller);
        }
    void Start()
    {
        m_initialCameraSize = Camera.main.orthographicSize;

        m_controller = new RotationController();

        m_meshObjects = new[] {
            InitMeshObject("Venus", 1.0f, Matrix4x4.identity),
            InitMeshObject("Ball", 2.0f, Matrix4x4.identity),
        };

        // Add controller 'Using' to Description
        GameObject.Find("Description")
        .GetComponent <UnityEngine.UI.Text>()
        .text += RotationController.Using;
    }
Example #24
0
    public void Init(GameManager gm, IPadInput input, GameWorldBoundaries gwb, Transform startTransform)
    {
        Input = input;
        this.startTransform = startTransform;

        gameManager         = gm;
        gameWorldBoundaries = gwb;

        positionController = GetComponent <PositionController>();
        positionController.Init(this);

        rotationController = GetComponent <RotationController>();
        rotationController.Init(this);

        reboundBehaviour = GetComponentInChildren <Rebound>();
        reboundBehaviour.Init(this, Data);
    }
Example #25
0
    void Awake()
    {
        player = GameObject.Find("FPSController");

        rotator = this.GetComponent <BodyRotator> ();
        if (control == null)
        {
            DontDestroyOnLoad(gameObject);
            control     = this;
            tcpListener = new TcpListener(IPAddress.Any, 8002);
            tcpListener.Start();
            RUNNING            = true;
            tcpServerRunThread = new Thread(new ThreadStart(TcpServerRun));
            tcpServerRunThread.Start();
        }
        else if (control != this)
        {
            Destroy(gameObject);
        }
    }
Example #26
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;
        }
    }
    /*****************************************************
    * SET FREE ROTATION
    *
    * INFO:    Permet d'activer ou désactiver la rotation
    *          par swipe sans contrôle d'angle.
    *
    *****************************************************/
    public void SetFreeRotation()
    {
        SpriteRenderer lockedRotation   = GameObject.FindWithTag("LockedRotation").GetComponent <SpriteRenderer>();
        SpriteRenderer unlockedRotation = GameObject.FindWithTag("UnlockedRotation").GetComponent <SpriteRenderer>();

        if (lockedRotation != null && unlockedRotation != null)
        {
            //Si la rotation contrôlé est active, on desactive la rotation contrôlé par angle
            RotationController.GetInstance().SetLockRotation(isControlRotation ? false : true);
            lockedRotation.enabled   = isControlRotation ? false : true;
            unlockedRotation.enabled = isControlRotation ? true : false;
            isControlRotation        = isControlRotation ? false : true;

            //Pour changer la couleur du label 'angle' (rotation)
            angleLabel = GameObject.FindWithTag("AngleLabel").GetComponent <TextMeshPro>();
            if (angleLabel != null)
            {
                angleLabel.color = isControlRotation ? whiteTrans : white;
            }
        }
    }
Example #28
0
 private void Awake()
 {
     rotationController = rotationControllerObject.GetComponent <RotationController>();
 }
Example #29
0
 private void Start()
 {
     m_MovementState            = GetComponent <MovementStateComponent>();
     m_RotationController       = GetComponent <RotationController>();
     EventOperations.MoveEvent += OnMoveEvent;
 }
 private void Start()
 {
     m_RotationController = GetComponent <RotationController>();
     EventOperations.ActionStateUpdateEvent += OnActionStateUpdateEvent;
 }
 private static RotationController Controller() {
     if (sController == null) {
         sController = GameObject().GetComponent<RotationController>();
     }
     return sController;
 }