The type or namespace name 'Movement' does not exist in the namespace 'RPG'

I think I know the problem here, there is no namespace with RPG.Movement…Sam has it in the video, so I must have forgotten to create it somewhere? Mover is under RPG.Control though.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using RPG.Combat;
using RPG.Movement;

namespace RPG.Control
{
    public class PlayerController : MonoBehaviour
    {
        private void Update()
        {
            InteractWithCombat();
            InteractWithMovement();
        }

        private void InteractWithCombat()
        {
            RaycastHit[] hits = Physics.RaycastAll(GetMouseRay());
            foreach (RaycastHit hit in hits)
            {
                CombatTarget target = hit.transform.GetComponent<CombatTarget>();
                if (target == null) continue;

                if (Input.GetMouseButtonDown())
                {
                    GetComponent<Fighter>().Attack();
                }
            }

        }

        private void InteractWithMovement()
        {
            if (Input.GetMouseButton(0))
            {
                MoveToCursor();
            }
        }

        private void MoveToCursor()
        {
            RaycastHit hit;
            bool hasHit = Physics.Raycast(ray, out hit);
            if (hasHit)
            {
                GetComponent<Mover>().MoveTo(hit.point);
            }
        }

        private static Ray GetMouseRay()
        {
            return Camera.main.ScreenPointToRay(Input.mousePosition);
        }
    }
}

I forgot to add it, fioxed

I come on the site a few times a day to check if there are any questions i can help some one with,
and lately i see you posting a lot, nice to see youre motivated but i have a question;

going from the questions you asked (the ones i read anyways) im going to assume that like me,
you have no programming knowledge before starting a Gamedev.tv course,
and im also going to assume you chose the RPG course to start with?

If i guessed both right, might i give you some advice, leave the RPG course be for now,
start with the 2d/3d course. and go back to the RPG course after that.

Mover should be under RPG.Movement. If it’s in RPG.Control, then Fighter will have to depend on Control to access the Mover, and the PlayerController (in Control) already depends on Fighter.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms