Ejemplo n.º 1
0
        public override void OnStart()
        {
            Trigger = Trigger ?? Actor.As <Collider>();

            Trigger.TriggerEnter += actor =>
            {
                if (actor.LayerName == "Player")
                {
                    CurrentAreas.Add(this);
                    Debug.Log("Edge set");
                }
            };

            Trigger.TriggerExit += actor =>
            {
                if (actor.LayerName == "Player")
                {
                    CurrentAreas.Remove(this);
                    if (CurrentAreas.Count == 0)
                    {
                        Checkpoint.Current.Load();
                        Debug.Log("Edge triggered");
                    }
                }
            };
        }
Ejemplo n.º 2
0
 public void Reset()
 {
     player.Position    = ResetPosition;
     player.Orientation = Quaternion.Identity;
     Physics.Gravity    = Vector3.Down * 981;
     player.As <RigidBody>().LinearVelocity = Vector3.Zero;
 }
Ejemplo n.º 3
0
        public override void OnUpdate()
        {
            if (Input.GetAction("Space"))
            {
                Actor          spawn      = PrefabManager.SpawnPrefab(FireworkPrefab, Camera.MainCamera.Position);
                ParticleEffect fireworkFX = spawn.As <ParticleEffect>();

                Color selectedColor = Colors[random.Next(0, Colors.Length)];
                fireworkFX.SetParameterValue("Fireworks_Sphere", "Fireworks Color", selectedColor);
                fireworkFX.SetParameterValue("Fireworks_Inner", "Fireworks Color", selectedColor);

                Destroy(spawn, 12);
            }
        }
Ejemplo n.º 4
0
        public override void OnAwake()
        {
            base.OnAwake();
            collider  = Actor.GetChild <CapsuleCollider>();
            rigidBody = Actor.As <RigidBody>();

            blueMat = ColorMaterial.CreateVirtualInstance();
            blueMat.SetParameterValue("Color", Color.Blue);
            redMat = ColorMaterial.CreateVirtualInstance();
            redMat.SetParameterValue("Color", Color.Red);
            currentRotationAngles = TargetRotationAngles;

            Screen.CursorVisible = false;
            Screen.CursorLock    = CursorLockMode.Locked;
        }
Ejemplo n.º 5
0
        public override void OnFixedUpdate()
        {
            if (Pausing)
            {
                WaitForPauseToEnd();
                return;
            }
            // Raycast
            if (Physics.RayCast(Actor.Position + new Vector3(0, 60, 0), Actor.Direction, out RayCastHit hit, 50f, layerMask: (1U << 2), true))
            {
                //DebugDraw.DrawSphere(new BoundingSphere(hit.Point, 50), Color.Red);
                if (!Asou1.IsActuallyPlayingSth)
                {
                    Asou1.Stop();
                }
                Asou1.Play();
                ColQty++;
                ColLabelQty.Get <Label>().Text = ColQty.ToString();
                hit.Collider.IsActive          = false;
            }

            // Get input axes
            if (!LaneChanging)
            {
                float inputH = Input.GetAxis("Horizontal");
                if (inputH < -0.1 && LaneID != -1)
                {
                    SetLaneTarget(-1);
                }
                if (inputH > 0.1 && LaneID != 1)
                {
                    SetLaneTarget(1);
                }
            }
            else
            {
                UpdateLaneMovement();
            }
            // Apply movement towards the target direction
            Vector3 movementDirection = Actor.Transform.TransformDirection(Vector3.Forward + (LaneMovement * LaneSpeed));

            // Apply controller movement, evaluate whether we are sprinting or not
            Actor.As <CharacterController>().Move(movementDirection * Time.DeltaTime * Speed);
        }
Ejemplo n.º 6
0
 public override void OnStart()
 {
     player  = Scene.FindScript(typeof(PlayerScript)) as PlayerScript;
     bar     = Actor.Parent.As <UIControl>();
     control = Actor.As <UIControl>().Control;
 }
Ejemplo n.º 7
0
 public override void OnStart()
 {
     particleEffect      = Actor.As <ParticleEffect>();
     particlesManagement = new ParticlesManagement();
     particlesManagement.Initialize(particleEffect);
 }
Ejemplo n.º 8
0
 public override void OnAwake()
 {
     Instance = this;
     Image    = Actor.As <UIControl>().Control as Image;
 }
Ejemplo n.º 9
0
 public override void OnEnable()
 {
     Actor.As <Collider>().TriggerEnter += OnTriggerEnter;
 }