コード例 #1
0
ファイル: LookAt.cs プロジェクト: GhostGirl6/NormandyGameJam
 void Awake()
 {
     a_UpVector            = GetComponent <IGravity>(); //Get the main camera
     aimer                 = GetComponent <IAim>();     //Get the main camera
     Anim                  = GetComponent <Animator>(); //Get the main camera
     aimer.IgnoreTransform = transform;
 }
コード例 #2
0
 void Start()
 {
     moveDirection = Vector3.zero;
     cc            = GetComponent <CharacterController>();
     movement      = new KeyboardController();
     aim           = new MouseController();
 }
コード例 #3
0
        public static void Main()
        {
            Console.CursorVisible = false;

            // Setting the console height and width.
            Console.BufferHeight = Console.WindowHeight = Constants.WorldRows + 1;
            Console.BufferWidth  = Console.WindowWidth = Constants.WorldCols;

            // Creating a renderer with the console height and width.
            IRenderer renderer = new ConsoleRenderer(Constants.WorldRows, Constants.WorldCols);

            // Assigning the user input to the keyboard.
            IUserKeyboardInput userInput = new KeyboardInput();

            // Creating an aim for the console user experience.
            IAim aim = Aim.Instance;

            // Ataching the aim methods to the userInput events
            userInput.OnDownPressed  += (sender, args) => { aim.MoveDown(); };
            userInput.OnLeftPressed  += (sender, args) => { aim.MoveLeft(); };
            userInput.OnRightPressed += (sender, args) => { aim.MoveRight(); };
            userInput.OnUpPressed    += (sender, args) => { aim.MoveUp(); };

            GameInitializator gameInitializator = new GameInitializator();

            // Creating an engine of the game.
            Engine engine = new Engine(renderer, userInput, aim, gameInitializator);

            // Starting the game.
            engine.Start();
        }
コード例 #4
0
        void OnTriggerExit(Collider other)
        {
            if (other.isTrigger)
            {
                return;                 //Ignore if the Collider exiting is a Trigger
            }
            IAim Aimer = other.GetComponentInParent <IAim>();

            if (Aimer != null)
            {
                Aimer.ForcedTarget = null;
                OnAimEnter.Invoke(false);
            }
        }
コード例 #5
0
        public Engine(IRenderer renderer, IUserKeyboardInput userInput, IAim aim, GameInitializator gameInitializator)
        {
            this.Renderer          = renderer;
            this.UserInput         = userInput;
            this.Aim               = aim;
            this.GameInitializator = gameInitializator;
            random = new Random();

            this.gameObjects = new HashSet <GameObject>();

            this.farm           = new Farm();
            this.farmManager    = new FarmManager();
            this.market         = new Market();
            this.presentFactory = new PresentFactory();
        }
コード例 #6
0
        public Engine(IRenderer renderer, IUserKeyboardInput userInput, IAim aim, GameInitializator gameInitializator)
        {
            this.Renderer = renderer;
            this.UserInput = userInput;
            this.Aim = aim;
            this.GameInitializator = gameInitializator;
            random = new Random();

            this.gameObjects = new HashSet<GameObject>();

            this.farm = new Farm();
            this.farmManager = new FarmManager();
            this.market = new Market();
            this.presentFactory = new PresentFactory();
        }
コード例 #7
0
        void OnTriggerEnter(Collider other)
        {
            if (other.isTrigger)
            {
                return;                  //Ignore if the Collider entering is a Trigger
            }
            IAim Aimer = other.GetComponentInParent <IAim>();

            if (Aimer != null)
            {
                //Aimer.Active = true;
                Aimer.ForcedTarget = transform;
                OnAimEnter.Invoke(true);
            }
        }
コード例 #8
0
ファイル: FireBallEffectM.cs プロジェクト: juanibar10/WOTW
        public override void StartEffect(Effect effect)
        {
            rb  = effect.Instance.GetComponent <Rigidbody>();       //Get the riggidbody of the effect
            aim = effect.Owner.GetComponent <IAim>();               //Check if the owner has lookAt

            effect.Instance.SendMessage("SetOwner", effect.Owner, SendMessageOptions.DontRequireReceiver);

            if (aim != null && aim.Active && !aim.Limited)
            {
                rb.AddForce(aim.AimDirection.normalized * velocity);     //If it has look at take the direction from te lookat
            }
            else
            {
                Animator ownerAnimator = effect.Owner.GetComponent <Animator>();
                Vector3  velocityv     = ownerAnimator.velocity.normalized;


                if (ownerAnimator.velocity.magnitude < 0.1)
                {
                    velocityv = effect.Owner.transform.forward;
                }
                rb.AddForce(velocityv * velocity);
            }
        }
コード例 #9
0
 public ModificationAim(IAim aim, Vector3 aimPosition)
 {
     _aim         = aim;
     _aimPosition = aimPosition;
 }
コード例 #10
0
 private void Awake()
 {
     _aim   = _aimObject.GetComponent <IAim>();
     _gun   = _gunObject.GetComponent <IGun>();
     _input = GetComponent <IInput>();
 }