Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        RaycastMovementDelegate = LinearRaycast;
        switch (type)
        {
        case ChessType.Knight:
            CanMoveDelegate         = CanMoveKnight;
            RaycastMovementDelegate = KnightRaycast;
            break;

        case ChessType.Bishop:
            CanMoveDelegate = CanMoveBishop;
            break;

        case ChessType.Rook:
            CanMoveDelegate = CanMoveRook;
            break;

        case ChessType.Queen:
            CanMoveDelegate = CanMoveQueen;
            break;

        case ChessType.King:
            CanMoveDelegate = CanMoveKing;
            break;
        }
    }
 public void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player");
     unitMovement = this.gameObject.GetComponent<RaycastMovement>();
     unitMovement.speed = moveSpeed;
     damage = str * 25; // how do i grab value from primary stat?
     attackSpeed = 2 - agl / 10;
     attackAvailable = true;
     InvokeRepeating("DirectionChange", 0, 2);
 }
    void Start ()
    {
        moveUpCommand = new MoveUpCommand();
        moveDownCommand = new MoveDownCommand();
        moveLeftCommand = new MoveLeftCommand();
        moveRightCommand = new MoveRightCommand();

        keyToCommand.Add(moveUpButton, moveUpCommand);
        keyToCommand.Add(moveDownButton, moveDownCommand);
        keyToCommand.Add(moveLeftButton, moveLeftCommand);
        keyToCommand.Add(moveRightButton, moveRightCommand);

        unitMovement = this.gameObject.GetComponent<RaycastMovement>();
        unitMovement.speed = playerSpeed;
	}
Example #4
0
    protected override void OnUpdate()
    {
        var raycastMovement = new RaycastMovement()
        {
            pw = World.GetOrCreateSystem <BuildPhysicsWorld>().PhysicsWorld
        };

        randomNumber.NextInt();
        var tempRandomNumber = randomNumber;

        Entities.ForEach((ref MoveData moveData, ref EnemyData enemyData, in Translation translation) =>
        {
            if (math.distance(translation.Value, enemyData.previousPosition) > 0.9f)
            {
                enemyData.previousPosition = math.round(translation.Value);

                var directionValidation = new NativeList <float3>(Allocator.Temp);

                if (!raycastMovement.RaycastCheck(translation.Value, new float3(0, 0, -1), moveData.movingDirection))
                {
                    directionValidation.Add(new float3(0, 0, -1));
                }
                if (!raycastMovement.RaycastCheck(translation.Value, new float3(0, 0, 1), moveData.movingDirection))
                {
                    directionValidation.Add(new float3(0, 0, 1));
                }
                if (!raycastMovement.RaycastCheck(translation.Value, new float3(-1, 0, 0), moveData.movingDirection))
                {
                    directionValidation.Add(new float3(-1, 0, 0));
                }
                if (!raycastMovement.RaycastCheck(translation.Value, new float3(1, 0, 0), moveData.movingDirection))
                {
                    directionValidation.Add(new float3(1, 0, 0));
                }

                moveData.movingDirection = directionValidation[tempRandomNumber.NextInt(directionValidation.Length)];

                directionValidation.Dispose();
            }
        }).Schedule();
    }
Example #5
0
    public void OnGazeTrigger()
    {
        RaycastMovement raycastMovement = FindObjectOfType <RaycastMovement> ();

        raycastMovement.move = true;
    }