Esempio n. 1
0
 void Start()
 {
     player          = GameObject.FindWithTag("Player").GetComponent <Player>();
     movementControl = GameObject.FindWithTag("MoveControl").GetComponent <MovementControl>();
     useControl      = GameObject.FindWithTag("UseControl").GetComponent <UseControl>();
     halo            = this.transform.gameObject.GetComponent("Halo");
 }
    void Awake()
    {
        heroInfo  = GetComponent <UnitInfo>().Info;
        msControl = GetComponent <MovementControl>();
        msControl.CurrentState = MovementControl.MovementState.MOVE;

        backgroundTexture = new Texture2D(1, 1, TextureFormat.RGB24, false);
        backgroundTexture.SetPixel(0, 0, Color.black);
        backgroundTexture.Apply();

        healthTexture = new Texture2D(1, 1, TextureFormat.RGB24, false);
        healthTexture.SetPixel(0, 0, Color.green);
        healthTexture.Apply();

        playerCamera = Camera.main.transform;
        //msControl.Target = transform.position;
        regenTimer          = Time.time;
        cameraDown          = new Rect(0, 0, Screen.width, guiSize);
        cameraUp            = new Rect(0, Screen.height - guiSize, Screen.width, guiSize);
        cameraLeft          = new Rect(0, 0, guiSize, Screen.height);
        cameraRight         = new Rect(Screen.width - guiSize, 0, guiSize, Screen.height);;
        heroMovementControl = GetComponent <MovementControl>();
        clickingMarker      = Instantiate(Resources.Load("ClickingMarker"), heroMovementControl.Position, Quaternion.identity) as GameObject;
        clickingMarker.SetActive(false);
        team = transform.tag;
    }
Esempio n. 3
0
    void Start()
    {
        float speedTweak = Random.value * 0.01f;

        moveDelegate = new MovementControl(1.1f, 0.6f, BASE_SPEED + speedTweak);
        chooseNewWanderAction();
    }
Esempio n. 4
0
        private void Hourse_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            MovementControl mhourse = sender as MovementControl;

            hourseposX.Text = "X = " + mhourse.X;
            hourseposY.Text = "Y = " + mhourse.Y;
        }
Esempio n. 5
0
    void AttachPlayersInside()
    {
        Debug.Log("attach players inside");
        _isGravityOn = true;
        for (int i = 0; i < _switchScript._playersInside.Count; i++)
        {
            MovementControl player = _switchScript._playersInside [i];
            if (_switchScript._switchColor != MovementControl.PlayerType.PurplePlayer)
            {
                if (_switchScript._switchColor != player._playerType)
                {
                    return;
                }
            }
            player._movementMode  = MovementControl.MovementMode.Circle;
            player.CirclingCenter = transform.position;
            player.CirclingRadius = _radius;

            Vector3 dirToPlayer = player.transform.position - transform.position;
            dirToPlayer.z = 0;
            float angle = Vector3.Angle(Vector3.up, dirToPlayer);
            if (dirToPlayer.x < 0)
            {
                angle = 360 - angle;
            }
            player.CirclingAngle   = angle;
            _playerStartAngles [i] = angle;
        }
    }
Esempio n. 6
0
        public void All_Robotic_rover_move_inmars_plateau()
        {
            IMatrix   plateau            = new MarsPlateau(5, 5);
            IPosition positionfirst      = new RoboticPosition(1, 2);
            IPosition positionsecond     = new RoboticPosition(3, 3);
            var       roboticRoverFirst  = new RoboticRover(positionfirst, Direction.N, plateau);
            var       roboticRoverSecond = new RoboticRover(positionsecond, Direction.E, plateau);

            roboticRoverFirst.Move("LMLMLMLMM");

            var control = new MovementControl <IRover, IMatrix>(roboticRoverFirst, plateau).RoverInMatrix();

            Assert.IsTrue(control);
            Assert.IsTrue(roboticRoverFirst.Position.X == 1, "First Position X is not true!");
            Assert.IsTrue(roboticRoverFirst.Position.Y == 3, "First Position Y is not true!");
            Assert.IsTrue(roboticRoverFirst.Direction == Direction.N, "First Direction is wrong!");

            roboticRoverSecond.Move("MMRMMRMRRM");
            control = new MovementControl <IRover, IMatrix>(roboticRoverSecond, plateau).RoverInMatrix();

            Assert.IsTrue(control);
            Assert.IsTrue(roboticRoverSecond.Position.X == 5, "Second Position X is not true!");
            Assert.IsTrue(roboticRoverSecond.Position.Y == 1, "Second Position Y is not true!");
            Assert.IsTrue(roboticRoverSecond.Direction == Direction.E, "Second Direction is wrong!");
        }
Esempio n. 7
0
 new void Awake()
 {
     base.Awake();
     cooldown = 1f; // 1 second for debug only
     duration = 15f;
     movement = GetComponent <MovementControl>();
 }
Esempio n. 8
0
 // Start is called before the first frame update
 void Start()
 {
     arrived = false;
     // movement = gameObject.GetComponent<MovementControl>();
     ai       = gameObject.GetComponent <AIBehaviour>();
     movement = gameObject.GetComponent <MovementControl>();
 }
Esempio n. 9
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player")
     {
         _player        = other.GetComponent <MovementControl>();
         _hasPlayerLeft = false;
     }
 }
Esempio n. 10
0
 void Start()
 {
     rb2d        = gameObject.GetComponent <Rigidbody2D>();
     hand        = GameObject.FindGameObjectWithTag("hand");
     boulder     = GameObject.FindGameObjectWithTag("boulder");
     rb2dboulder = boulder.GetComponent <Rigidbody2D>();
     movectrl    = gameObject.GetComponentInParent <MovementControl>();
 }
Esempio n. 11
0
        public WhenNavigating()
        {
            var logger           = new NullLoggerFactory().CreateLogger("Logger");
            var directionControl = new DirectionControl();
            var movementControl  = new MovementControl();

            _navigationControl = new NavigationControl(movementControl, directionControl, logger);
        }
Esempio n. 12
0
    private void Start()
    {
        agent = GetComponentInChildren<NavMeshAgent>();
        character = GetComponent<MovementControl>();

        agent.updateRotation = false;
        agent.updatePosition = true;
    }
Esempio n. 13
0
    void Start()
    {
        GM = FindObjectOfType <GameManager>();

        mControl = GetComponent <MovementControl>();

        InvokeRepeating("CheckPlayerState", 1f, 1f);
    }
Esempio n. 14
0
        private void Hourse_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            MovementControl mhourse = sender as MovementControl;

            hourseName.Text       = mhourse.HourseName;
            hourseSpeed.Text      = mhourse.Speed.ToString();
            hourseroundcount.Text = mhourse.currentCountRound.ToString();
        }
 public void UpdateStatistics(BaseUnit unit, List <Vector3> points)
 {
     GetComponent <UnitInfo>().Info = unit;
     minionInfo = GetComponent <UnitInfo>().Info;
     minionInfo.NextAttackTime = Time.time + minionInfo.AttackSpeed;
     waypoints = points;
     msControl = GetComponent <MovementControl>();
     msControl.UpdateStatistics();
 }
Esempio n. 16
0
 // Start is called before the first frame update
 void Start()
 {
     _userDrawnShapePoints  = new List <Vector3>();
     _userDrawnHullVertices = new List <Vector3>();
     _userDrawnHullLines    = new List <Vector3[]>();
     _currentButtons        = new List <GameObject>();
     _pointCloudGenerator   = GetComponent <PointCloudGenerator>();
     movement_control       = GetComponent <MovementControl>();
 }
Esempio n. 17
0
    void OnTriggerExit2D(Collider2D other)
    {
        if (!this.enabled)
        {
            return;
        }
        if (other.tag == "Player")
        {
            MovementControl playerScript = other.GetComponent <MovementControl> ();
            _playersInside.Remove(playerScript);

            if (playerScript._playerType != MovementControl.PlayerType.PurplePlayer)
            {
                if (!_mustHoldDown)
                {
                    return;
                }
            }

            if (_switchColor == MovementControl.PlayerType.PurplePlayer)
            {
                _isPlayerInside = false;
            }
            else if (_switchColor == MovementControl.PlayerType.AnyPlayer)
            {
                _isPlayerInside = false;
            }
            else
            {
                if (_switchColor == playerScript._playerType)
                {
                    _isPlayerInside = false;
                }
            }

            if (!_isPlayerInside)
            {
                if (_switchColor == MovementControl.PlayerType.BluePlayer)
                {
                    _spriteRenderer.color = new Color(0, 0.5f, 1);
                }
                else if (_switchColor == MovementControl.PlayerType.RedPlayer)
                {
                    _spriteRenderer.color = Color.red;
                }
                else if (_switchColor == MovementControl.PlayerType.AnyPlayer)
                {
                    _spriteRenderer.color = Color.yellow;
                }
                else
                {
                    _spriteRenderer.color = new Color(0.5f, 0, 1);
                }
                _isOn = false;
            }
        }
    }
Esempio n. 18
0
        public WhenExecutingMission()
        {
            var logger            = new NullLoggerFactory().CreateLogger("Logger");
            var directionControl  = new DirectionControl();
            var movementControl   = new MovementControl();
            var planControl       = new PlanControl(logger);
            var navigationControl = new NavigationControl(movementControl, directionControl, logger);

            _missionControl = new MissionControl(logger, navigationControl, planControl);
        }
 public void StartingStatistics(Hero info)
 {
     GetComponent <UnitInfo>().Info = info;
     heroInfo                = GetComponent <UnitInfo>().Info;
     heroInfo.Abilities      = new SkillData[] { new TestBolt() };
     heroInfo.NextAttackTime = Time.time;
     msControl               = GetComponent <MovementControl>();
     msControl.UpdateStatistics();
     UpdateEffects();
 }
Esempio n. 20
0
    public static void StartMoveScale(GameObject target, SkillMoveScaleInfo info)
    {
        MovementControl tLockFrame = target.gameObject.GetComponent <MovementControl>();

        if (tLockFrame == null)
        {
            LogicSystem.GfxLog("StartMoveScale component miss!");
            return;
        }
        tLockFrame.StartMoveScale(info);
    }
Esempio n. 21
0
    public static void NotifyIngoreGravity(GameObject target, bool isIngore)
    {
        MovementControl mgr = target.GetComponent <MovementControl>();

        if (mgr == null)
        {
            LogicSystem.GfxLog("NotifyIngoreGravity control miss!");
            return;
        }
        mgr.NotifyIngoreGravity(isIngore);
    }
Esempio n. 22
0
 public override void OnEquipped()
 {
     isEquipped     = true;
     data           = (RocketBootData)itemData;
     entityMovement = data.ownerEntity.GetComponent <MovementControl>();
     entityBody     = data.ownerEntity.GetComponent <Rigidbody>();
     if (orientation == null)
     {
         orientation = transform.parent;
     }
 }
Esempio n. 23
0
    public static void StopMove(GameObject target)
    {
        MovementControl mgr = target.GetComponent <MovementControl>();

        if (mgr == null)
        {
            LogicSystem.GfxLog("StartMove movement control miss!");
            return;
        }
        mgr.StopMove();
    }
Esempio n. 24
0
    IEnumerator ChangeSpeed(float speedMultiplier, float duration)
    {
        MovementControl mControl = gameObject.GetComponentInChildren <MovementControl>();

        if (mControl != null)
        {
            mControl.speed *= speedMultiplier;
            yield return(new WaitForSeconds(duration));

            mControl.speed /= speedMultiplier;
        }
    }
Esempio n. 25
0
 // Use this for initialization
 void Start()
 {
     cameraDown          = new Rect(0, 0, Screen.width, guiSize);
     cameraUp            = new Rect(0, Screen.height - guiSize, Screen.width, guiSize);
     cameraLeft          = new Rect(0, 0, guiSize, Screen.height);
     cameraRight         = new Rect(Screen.width - guiSize, 0, guiSize, Screen.height);
     heroBehaviour       = hero.GetComponent <HeroBehavior>();
     heroMovementControl = hero.GetComponent <MovementControl>();
     clickingMarker      = Instantiate(Resources.Load("ClickingMarker"), heroMovementControl.Position, Quaternion.identity) as GameObject;
     clickingMarker.SetActive(false);
     team = "BlueTeam";
 }
    void Awake()
    {
        msControl = GetComponent <MovementControl>();
        msControl.UpdateStateInfo(MovementControl.MovementState.STOP);
        team = gameObject.tag;

        backgroundTexture = new Texture2D(1, 1, TextureFormat.RGB24, false);
        backgroundTexture.SetPixel(0, 0, Color.black);
        backgroundTexture.Apply();

        healthTexture = new Texture2D(1, 1, TextureFormat.RGB24, false);
        healthTexture.SetPixel(0, 0, Color.green);
        healthTexture.Apply();
    }
Esempio n. 27
0
    void Start()
    {
        if (player == null)
        {
            player = GameObject.FindGameObjectWithTag("Player");
        }
        GM = FindObjectOfType <GameManager>();

        if (player != null)
        {
            mControl = player.GetComponent <MovementControl>();
            health   = player.GetComponent <Health>();
            score    = player.GetComponent <Score>();

            if (livesSprite != null)
            {
                livesTexture = Misc.GetTextureFromSprite(livesSprite);
            }
            if (healthSprite != null)
            {
                healthTexture = Misc.GetTextureFromSprite(healthSprite);
            }
            if (coinSprite != null)
            {
                coinTexture = Misc.GetTextureFromSprite(coinSprite);
            }
            if (fireSprite != null)
            {
                fireTexture = Misc.GetTextureFromSprite(fireSprite);
            }
            if (iceSprite != null)
            {
                iceTexture = Misc.GetTextureFromSprite(iceSprite);
            }
        }
        background = new Texture2D(1, 1);
        background.SetPixel(0, 0, hudBackgroundColor);
        background.Apply();
        hudStyle = new GUIStyle();
        hudScale = (int)(Screen.height * hudHeightPercent);
        padding  = new Rect(hudScale / 5, hudScale / 5, hudScale / 5, hudScale / 5);

        if (font != null)
        {
            hudStyle.font = font;
        }
        hudStyle.fontSize         = (int)(hudScale / 3.125f);
        hudStyle.normal.textColor = Color.white;
    }
Esempio n. 28
0
        public void Second_Robotic_rover_move_inmars_plateau()
        {
            IMatrix   plateau  = new MarsPlateau(5, 5);
            IPosition position = new RoboticPosition(3, 3);

            var roboticRover = new RoboticRover(position, Direction.E, plateau);

            roboticRover.Move("MMRMMRMRRM");
            var control = new MovementControl <IRover, IMatrix>(roboticRover, plateau).RoverInMatrix();

            Assert.IsTrue(control);
            Assert.IsTrue(roboticRover.Position.X == 5, "Position X is not true");
            Assert.IsTrue(roboticRover.Position.Y == 1, "Position Y is not true");
            Assert.IsTrue(roboticRover.Direction == Direction.E, "Direction is not true");
        }
Esempio n. 29
0
    void Start()
    {
        player   = GameObject.FindGameObjectWithTag("Player");
        mControl = GetComponent <MovementControl>();
        rBody    = GetComponentInChildren <Rigidbody2D>();

        moveDirection = new Vector2(-1, 0);

        InvokeRepeating("FollowPath", 0, 0.5f);

        if (player != null && mControl != null)
        {
            InvokeRepeating("CheckShooting", 1f, 1 / mControl.shotsPerSecond);
        }
    }
Esempio n. 30
0
    void Start()
    {
        mControl = parent.GetComponent <MovementControl>();
        rBody    = GetComponent <Rigidbody2D>();

        if (parent.tag == "Enemy")
        {
            gameObject.layer = 12;
        }

        if (rBody != null && mControl != null)
        {
            rBody.AddForce(new Vector2(speedX * mControl.GetFacingDir(), speedY), ForceMode2D.Impulse);
        }

        AudioControl.PlayerShootFireball(); //Toistaa äänen
    }
    // Use this for initialization
    void Start()
    {
        msControl = GetComponent <MovementControl>();
        UpdateStatistics(new BaseUnit("Minion", transform, "Minion", 250.0, 15, 0, 50, 9, 0.75f, 0f, 20, 5, 0, 2, 2, 2, 0f, 0f, 0f, 0f),
                         new List <Vector3> {
            new Vector3(15, 0, 0), new Vector3(10, 0, 0), new Vector3(-20, 0, 0)
        });
        msControl.UpdateStateInfo(MovementControl.MovementState.ATTACKMOVE);
        team = gameObject.tag;

        backgroundTexture = new Texture2D(1, 1, TextureFormat.RGB24, false);
        backgroundTexture.SetPixel(0, 0, Color.black);
        backgroundTexture.Apply();

        healthTexture = new Texture2D(1, 1, TextureFormat.RGB24, false);
        healthTexture.SetPixel(0, 0, Color.green);
        healthTexture.Apply();
    }