Example #1
0
    ////////////////////////////////////////////////

    private void SetNextTarget()
    {
        _currTargetStaticLoc = _nodes[locCount];
        _currTargetScript    = LocationManager.GetLocationScript_SERVER(_nodes[locCount]);

        if (!LocationManager.SetUnitOnCube_SERVER(GetComponent <UnitScript>(), _currTargetStaticLoc))
        {
            Debug.LogWarning("units movement interrupted >> recalculating");
            moveInProgress = false;
            Reset();
            //NetWorkManager.NetworkAgent.ServerTellClientToFindNewPathForUnit(PlayerManager.PlayerAgent.NetID, _finalTargetStaticLoc);
        }
    }
Example #2
0
    ////////////////////////////////////////////////
    ////////////////////////////////////////////////

    ////////////////////////////////////////////////
    ////// SERVER FUNCTIONS ////////////////////////
    ////////////////////////////////////////////////

    public static void UpdateServerLocation_SERVER(Vector3 vect, bool[] cubeData)
    {
        //Debug.Log("UpdateServerLocation_SERVER");

        if (!_SERVER_LocationLookup.ContainsKey(vect))
        {
            CubeLocation_SERVER cubeServerScript = ScriptableObject.CreateInstance <CubeLocation_SERVER>();
            cubeServerScript.SetCubeData(cubeData);
            _SERVER_LocationLookup.Add(vect, cubeServerScript);
            //Debug.Log("UpdateServerLocation_SERVER vect " + vect);
        }
        else
        {
            CubeLocation_SERVER cubeServerScript = _SERVER_LocationLookup[vect];
            cubeServerScript.SetCubeData(cubeData);
        }
    }
Example #3
0
    ////////////////////////////////////////////////

    public static CubeLocation_SERVER CheckIfCanMoveToCube_SERVER(bool unitIsAlien, Vector3 loc)
    {
        //Debug.Log("CheckIfCanMoveToCube loc: " + neighloc);

        CubeLocation_SERVER cubeScript = GetLocationScript_SERVER(loc);

        if (cubeScript == null)
        {
            Debug.LogError("FAIL move cubeScript == null: " + loc);
            return(null);
        }

        if (_SERVER_unitLocation.ContainsValue(loc))
        {
            Debug.LogWarning("Cube occupied on SERVER: " + loc);
            return(null);
        }

        if (!unitIsAlien)  // if human
        {
            if (!cubeScript.IS_HUMAN_MOVABLE)
            {
                Debug.LogWarning("FAIL move error Human walkable/climable/jumpable: " + loc);
                return(null);
            }
        }
        else // alien
        {
            if (!cubeScript.IS_ALIEN_MOVABLE)
            {
                Debug.LogWarning("FAIL move error ALIEN walkable/climable/jumpable: " + loc);
                return(null);
            }
        }

        Debug.Log("SUCCES on SERVER move to loc: " + loc);
        return(cubeScript);
    }