示例#1
0
    public void HandleInput(Character3D character)
    {
        //This is randomly selecting direction, change this to change how AI Characters work
        float xInput    = Random.Range(-1.0f, 1.0f);
        float yInput    = Random.Range(-1.0f, 1.0f);
        bool  isJumping = Random.Range(-1.0f, 1.0f) > 0;

        character.Move(xInput, yInput, isJumping);
    }
示例#2
0
    public void HandleInput(Character3D character)
    {
        float mouseX = Input.GetAxisRaw("Mouse X");
        float mouseY = Input.GetAxisRaw("Mouse Y");

        float MoveRight   = Input.GetAxisRaw("Horizontal");
        float MoveForward = Input.GetAxisRaw("Vertical");

        bool isJumping = Input.GetButtonDown("Jump");

        character.Move(MoveRight, MoveForward, isJumping);
        character.Look(mouseX, mouseY);
    }
示例#3
0
    private void RenderCollision <T>(Type type) where T : Collider
    {
        T[]   colliders = UnityEngine.Object.FindObjectsOfType <T>();
        Color color     = ColliderColor(type);

        AddToRenderList(colliders);

        switch (type)
        {
        case Type.Boxes:
            Box3D.Render(colliderList, color, EdgeAlpha, color, FaceAlpha, IsSet(Flags.NoDepth));
            Box3D.Render(triggerList, triggerColor, EdgeAlpha, triggerColor, FaceAlpha, IsSet(Flags.NoDepth));
            break;

        case Type.Spheres:
            Sphere3D.Render(colliderList, color, EdgeAlpha, color, FaceAlpha, IsSet(Flags.NoDepth));
            Sphere3D.Render(triggerList, triggerColor, EdgeAlpha, triggerColor, FaceAlpha, IsSet(Flags.NoDepth));
            break;

        case Type.Capsules:
            Capsule3D.Render(colliderList, color, EdgeAlpha, color, FaceAlpha, IsSet(Flags.NoDepth));
            Capsule3D.Render(triggerList, triggerColor, EdgeAlpha, triggerColor, FaceAlpha, IsSet(Flags.NoDepth));
            break;

        case Type.Meshes:
            Mesh3D.Render(colliderList, color, EdgeAlpha, color, FaceAlpha, IsSet(Flags.NoDepth));
            Mesh3D.Render(triggerList, triggerColor, EdgeAlpha, triggerColor, FaceAlpha, IsSet(Flags.NoDepth));
            break;

        case Type.Characters:
            Character3D.Render(colliderList, color, EdgeAlpha, color, FaceAlpha, IsSet(Flags.NoDepth));
            Character3D.Render(triggerList, triggerColor, EdgeAlpha, triggerColor, FaceAlpha, IsSet(Flags.NoDepth));
            guiColliderCount[(int)Type.Capsules] += colliderList.Count + triggerList.Count;
            break;
        }

        guiColliderCount[(int)type] += colliderList.Count + triggerList.Count;
    }