Beispiel #1
0
 private void DoUpdate(GameManager.UpdateData data)
 {
     for (int i = emitters.Count - 1; i >= 0; i--)
     {
         emitters[i].DoUpdate(data);
     }
 }
Beispiel #2
0
 public virtual void DoUpdate(GameManager.UpdateData data)
 {
     if (decorator != null)
     {
         decorator.DoUpdate(data);
     }
 }
Beispiel #3
0
    public virtual void HandlePhysics(GameManager.UpdateData data, Vector3?frictionOverride, Vector3?gravityOverride)
    {
        if (backgroundDistance < onLayer)
        {
            backgroundDistance = onLayer;
        }
        if (groundFound || wallFound)
        {
            _bodyCollider.transform.localScale   = new Vector3(1, 1, onLayer);
            _groundCheck.transform.localScale    = new Vector3(1, 1, onLayer);
            _rightWallCheck.transform.localScale = new Vector3(1, 1, onLayer);
            _leftWallCheck.transform.localScale  = new Vector3(1, 1, onLayer);
            _ceilingCheck.transform.localScale   = new Vector3(1, 1, onLayer);
        }
        else
        {
            bool passThrough = lastAction == AgentManager.Instance.settings.propPassThroughAction && activeActionValue > 0;
            bool wallCollide = lastAction == AgentManager.Instance.settings.propCollideAction && activeActionValue > 0;
            _bodyCollider.transform.localScale   = new Vector3(1, 1, 1);
            _groundCheck.transform.localScale    = new Vector3(1, 1, (passThrough ? 1 : backgroundDistance));
            _rightWallCheck.transform.localScale = new Vector3(1, 1, (wallCollide ? backgroundDistance : 1));
            _leftWallCheck.transform.localScale  = new Vector3(1, 1, (wallCollide ? backgroundDistance : 1));
            _ceilingCheck.transform.localScale   = new Vector3(1, 1, 1);
        }

        physicsBody.HandleGravity(data, gravityOverride);
        physicsBody.HandleFriction(frictionOverride);
    }
 private void DoUpdate(GameManager.UpdateData data)
 {
     for (int i = props.Count - 1; i >= 0; i--)
     {
         props[i].DoUpdate(data);
     }
 }
 public void DoUpdate(GameManager.UpdateData data)
 {
     if (!_particleSystem.IsAlive())
     {
         Destroy(gameObject);
         return;
     }
 }
Beispiel #6
0
    public override void DoUpdate(GameManager.UpdateData data)
    {
        if (controlQueue.Count > 0)
        {
            SubmitAction();
        }

        if (activeActionValue != 0)
        {
            Control control = Control.Horizontal;
            switch (lastAction)
            {
            case Action.MoveForward:
                control = Control.Horizontal;
                break;

            case Action.MoveBack:
                control = Control.Horizontal;
                break;

            case Action.MoveUp:
                control = Control.Vertical;
                break;

            case Action.MoveDown:
                control = Control.Vertical;
                break;

            case Action.Jump:
                control = Control.Jump;
                break;

            case Action.AttackBack:
                control = Control.Attack;
                break;

            case Action.AttackDown:
                control = Control.Attack;
                break;

            case Action.AttackForward:
                control = Control.Attack;
                break;

            case Action.AttackUp:
                control = Control.Attack;
                break;
            }
            if (controlState[control] == 0)
            {
                PerformAction(lastAction, 0);
            }
        }

        base.DoUpdate(data);
    }
 void DoUpdate(GameManager.UpdateData data)
 {
     for (int i = sources.Count - 1; i >= 0; i--)
     {
         if (sources[i] == null ||
             !sources[i].isPlaying)
         {
             sources.RemoveAt(i);
         }
     }
 }
Beispiel #8
0
    public void HandleGravity(GameManager.UpdateData data, Vector3?gravityOverride)
    {
        if (!useGravity)
        {
            return;
        }

        Vector3 gravity = gravityOverride ?? EnvironmentManager.Instance.GetEnvironment().gravity;

        AddVelocity(gravity * data.deltaTime);
    }
    void DoUpdate(GameManager.UpdateData data)
    {
        if (GameManager.Instance.State != GameManager.GameState.menu && GameManager.Instance.State != GameManager.GameState.pause)
        {
            return;
        }

        foreach (Menu menu in menues)
        {
            menu.DoUpdate(data);
        }
    }
Beispiel #10
0
    public virtual void Update(GameManager.UpdateData data, float value)
    {
        if (updateStrategies == null)
        {
            return;
        }

        foreach (UpdateTechStrategy strategy in updateStrategies)
        {
            strategy.Update(this, data, value);
        }
    }
Beispiel #11
0
    public override void Update(Technique tech, GameManager.UpdateData data, float value)
    {
        if (Mathf.Abs(tech.owner.physicsBody.velocity.x) < maxSpeed ||
            Mathf.Sign(value) != Mathf.Sign(tech.owner.physicsBody.velocity.x))
        {
            Vector3 velDelta = (tech.owner.isFacingRight ? Vector3.right : Vector3.left) * (acceleration * data.deltaTime * value);

            tech.owner.physicsBody.AddVelocity(velDelta);
        }

        tech.owner.HandlePhysics(data);
        tech.owner.HandleAnimation();
    }
Beispiel #12
0
    public void DoUpdate(GameManager.UpdateData data)
    {
        bool anyKeyThisFrame = HandleKeys();

        HandleAxes();

        if (anyKeyThisFrame)
        {
            if (AnyInput != null)
            {
                AnyInput(1);
            }
        }
    }
    void DoFixedUpdate(GameManager.UpdateData data)
    {
        if (shakeDuration > 0)
        {
            float xVal = Random.Range(-shakeRadius, shakeRadius);
            float yVal = Random.Range(-shakeRadius, shakeRadius);
            _camera.transform.localPosition = new Vector3(xVal, yVal, cameraZDistance);

            shakeRadius   -= shakeRadius * (data.deltaTime / shakeDuration);
            shakeDuration -= data.deltaTime;
        }
        else
        {
            _camera.transform.localPosition = new Vector3(0, 0, cameraZDistance);
        }
    }
Beispiel #14
0
    protected override void DoFixedUpdate(GameManager.UpdateData data)
    {
        if (target == null)
        {
            return;
        }

        Vector3 targetPosition = target.position;

        if (offsetByTargetVelocity)
        {
            PhysicsBody targetBody = target.GetComponent <PhysicsBody>();
            if (targetBody != null)
            {
                targetPosition += targetBody.velocity;
            }
        }

        Vector3 offset = targetPosition - cameraBase.transform.position;

        if (Mathf.Sign(velocity.x) != Mathf.Sign(offset.x))
        {
            velocity.x = velocity.x * (1 - dampening);
        }
        velocity.x += (offset.x / deadZone.x) * acceleration * data.deltaTime;

        if (Mathf.Sign(velocity.y) != Mathf.Sign(offset.y))
        {
            velocity.y = velocity.y * (1 - dampening);
        }
        velocity.y += (offset.y / deadZone.y) * acceleration * data.deltaTime;

        if (velocity.magnitude > 0)
        {
            velocity = velocity * (1 - friction);
            if (velocity.magnitude < stopSpeed)
            {
                velocity = new Vector3();
            }
        }

        Vector3 oldPosition = cameraBase.transform.position;

        cameraBase.Move(velocity, true);
        velocity = cameraBase.transform.position - oldPosition;
    }
Beispiel #15
0
    public override void Update(Technique tech, GameManager.UpdateData data, float value)
    {
        Vector3?friction = new Vector3();
        Vector3?gravity  = null;

        if (tech.owner.physicsBody.velocity.y >= 0)
        {
            gravity = EnvironmentManager.Instance.GetEnvironment().gravity *gravityMultiplier;
            tech.owner.animator.SetBool("WallRunning", true);
        }
        else
        {
            friction = tech.owner.physicsBody.frictionCoefficients * frictionMultiplier;
            tech.owner.animator.SetBool("WallRunning", false);
        }

        tech.owner.HandlePhysics(data, friction, gravity);
    }
    public override void Update(Technique tech, GameManager.UpdateData data, float value)
    {
        double charge = (tech.GetBlackboardData("charge") as double?) ?? 0.0;

        if (charge < minimumCharge)
        {
            tech.SetBlackboardData("charge", minimumCharge);
        }
        else if (charge < maximumCharge)
        {
            tech.SetBlackboardData("charge", charge + (chargeRate * data.deltaTime));
        }

        if (tech.owner.slideParticle != null)
        {
            tech.owner.slideParticle.enabled = true;
        }
        tech.owner.HandlePhysics(data, tech.owner.physicsBody.frictionCoefficients * frictionMultiplier);
    }
Beispiel #17
0
    public virtual void DoUpdate(GameManager.UpdateData data)
    {
        if (slideParticle != null)
        {
            slideParticle.enabled = false;
        }
        CheckState();

        HandleTechniques();
        if (ValidActiveTechnique())
        {
            activeTechnique.Update(data, _activeActionValue);
        }
        else
        {
            if (slideParticle != null)
            {
                slideParticle.enabled = true;
            }
            HandlePhysics(data);
            HandleAnimation();
        }
    }
Beispiel #18
0
 public virtual void HandlePhysics(GameManager.UpdateData data, Vector3?frictionOverride)
 {
     HandlePhysics(data, frictionOverride, null);
 }
Beispiel #19
0
 public void DoUpdate(GameManager.UpdateData data)
 {
 }
    protected override void DoFixedUpdate(GameManager.UpdateData data)
    {
        Vector2 fixedMotion = motion * data.deltaTime;

        cameraBase.Move(fixedMotion, true);
    }
 protected override void DoFixedUpdate(GameManager.UpdateData data)
 {
     HandleZoom();
     HandleMovement();
 }
Beispiel #22
0
 public override void Update(Technique tech, GameManager.UpdateData data, float value)
 {
     tech.owner.HandlePhysics(data);
     return;
 }
Beispiel #23
0
 public abstract void Update(Technique tech, GameManager.UpdateData data, float value);
Beispiel #24
0
 public virtual void HandlePhysics(GameManager.UpdateData data)
 {
     HandlePhysics(data, null, null);
 }
Beispiel #25
0
 protected virtual void DoFixedUpdate(GameManager.UpdateData data)
 {
     // No action
 }