Inheritance: MonoBehaviour
Example #1
0
        protected override void PhysicsUpdate(float dt)
        {
            if (!CanMove)
            {
                return;
            }

            if (!PlayerBehaviorData.AllowAirControl && IsFalling)
            {
                return;
            }

            Vector3    fixedDirection = new Vector3(MoveDirection.x, 0.0f, MoveDirection.y);
            Vector3    velocity       = fixedDirection * PlayerBehaviorData.MoveSpeed;
            Quaternion rotation       = Movement3D.Rotation;

            if (null != Player.Viewer)
            {
                // rotate with the camera instead of the movement
                rotation = Quaternion.AngleAxis(Player.Viewer.transform.localEulerAngles.y, Vector3.up);
            }
            velocity = rotation * velocity;

            if (Movement3D.IsKinematic)
            {
                Movement3D.Teleport(Movement3D.Position + velocity * dt);
            }
            else
            {
                velocity.y          = Movement3D.Velocity.y;
                Movement3D.Velocity = velocity;
            }

            base.PhysicsUpdate(dt);
        }
Example #2
0
 // Use this for initialization
 void Start()
 {
     movement = GetComponent <Movement3D>();
     if (!movement)
     {
         movement = gameObject.AddComponent <Movement3D>();
     }
     movement.controllable = false;
 }
Example #3
0
 // Use this for initialization
 void Start()
 {
     movement = GetComponent<Movement3D>();
     if (!movement)
     {
         movement = gameObject.AddComponent<Movement3D>();
     }
     movement.controllable = false;
 }
Example #4
0
    void Awake()
    {
        if (Instance_3d == null)
        {
            Instance_3d = this;
        }

        if (Instance_3d != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Example #5
0
    private void Update()
    {
        if (movement3D == null)
        {
            movement3D = GetComponent <Movement3D>();
        }
        if (playerAnimator == null)
        {
            playerAnimator = GetComponent <PlayerAnimator>();
        }
        if (FreeLookCam.instance == null)
        {
            return;
        }

        PlayerAttack();
        PlayerMove();
        PlayerJump();
    }
Example #6
0
    void Start()
    {
        equippedBagPackSpace = GameObject.Find("Equipped Bagpack Space");
        playerObject = GameObject.FindGameObjectWithTag("MainCamera");
        M3 = GameObject.FindGameObjectWithTag("Player").GetComponent<Movement3D>();
        heldBagpackSpace = GameObject.Find("Held Bagpack Space");
        arms = GameObject.Find("Arms").GetComponent<ArmsScript>();
        bagSlots = GameObject.FindGameObjectsWithTag("BagSlot");

        for (int i = 0; i < bagSlots.Length; i++)
        {
            if (bagSlots[i] == null)
            {
                Debug.Log("ERROR: Missing Object at Inventory System.");
            }
        }
        openSound = GameObject.Find ("BackpackOpenSound");
        closeSound = GameObject.Find ("BackpackCloseSound");
        retreiveSound = GameObject.Find ("BackpackRetreiveItemSound");
        storeSound = GameObject.Find ("BackpackStoreItemSound");
    }
 void Start()
 {
     movement3D = GetComponent<Movement3D>();
 }
Example #8
0
 void Start()
 {
     M3 = GameObject.FindGameObjectWithTag("Player").GetComponent<Movement3D>();
     currentXRotation = transform.rotation.x;
     currentYRotation = transform.rotation.y;
 }
Example #9
0
 // Use this for initialization
 void Start()
 {
     mover = player.GetComponent<Movement3D> ();
     playerThere = false;
     bossCurrentHealth = bossEndurance;
 }
Example #10
0
 private void Awake()
 {
     movement3D = GetComponent <Movement3D>();
 }
Example #11
0
 private void Awake()
 {
     movement3D          = GetComponent <Movement3D>();
     characterController = GetComponent <CharacterController>();
 }
Example #12
0
 // Use this for initialization
 void Start()
 {
     crossedCheckpoint = false;
     mover = player.GetComponent<Movement3D> ();
     anim = gameObject.GetComponent<Animation> ();
 }
Example #13
0
    void Awake()
    {
        //equippedBagPackSpace = GameObject.Find("Equipped Bagpack Space");
        playerObject = GameObject.FindGameObjectWithTag("MainCamera");
        M3 = GameObject.FindGameObjectWithTag("Player").GetComponent<Movement3D>();
        //heldBagpackSpace = GameObject.Find("Held Bagpack Space");
        arms = GameObject.Find("Arms").GetComponent<ArmsScript>();

        bagSlots = new GameObject[8]; //initiates bagSlots array and fills it in order.
        bagSlots[0] = GameObject.Find("BagSlot");
        for (int i = 1; i < bagSlots.Length; i++)
        {
            bagSlots[i] = GameObject.Find("BagSlot ("+i+")");
        }

        handStartPos = GameObject.Find("RightArm").transform.localPosition;
        handDefaultRot = GameObject.Find("RightArm").transform.localRotation;

        for (int i = 0; i < bagSlots.Length; i++)
        {
            if (bagSlots[i] == null)
            {
                //Debug.Log("ERROR: Missing Object at Inventory System.");
            }
        }
        openSound = GameObject.Find ("BackpackOpenSound");
        closeSound = GameObject.Find ("BackpackCloseSound");
        //retreiveSound = GameObject.Find ("BackpackRetreiveItemSound");
        storeSound = GameObject.Find ("BackpackStoreItemSound");
    }
Example #14
0
 void Start()
 {
     movement = GetComponent <Movement3D>();
 }