示例#1
0
 public bool PerceptionCheck(MapMaker.Node node)
 {
     if (Physics.Linecast(new Vector3(transform.position.x, transform.position.y + unitHeight, transform.position.z),
                          new Vector3(node.x, node.y + 1, node.z), tileMask))
     {
         return(false);
     }
     return(true);
 }
示例#2
0
    public void TargetTimeToReach(NetworkConnection target, int x, int y, int z, int index)
    {
        MapMaker.Node node = map.graph[x, y, z];

        if (shortPath.Contains(node))
        {
            tpm = timePerMove * shortPath.IndexOf(node) / index;
        }
        else
        {
            tpm = float.MaxValue;
        }
    }
示例#3
0
 bool IsPositionOccupied(MapMaker.Node step)
 {
     CharacterStats[] characters = FindObjectsOfType <CharacterStats>();
     foreach (CharacterStats character in characters)
     {
         if (character.gameObject != gameObject)
         {
             if (character.basics.tileX == step.x && character.basics.tileY == step.y && character.basics.tileZ == step.z)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
示例#4
0
    public void CancelAction(string act)
    {
        if (act != null)
        {
            if (act == "Move")
            {
                MoveClear();
            }

            else if (act == "meleeFirst")
            {
                meleeThis = null;
            }

            else if (act == "Block")
            {
                StopBlocking();
            }

            else if (act == "Reload")
            {
                reloading = false;
            }

            else
            {
                movementActions++;
                basics.CheckPath();
            }

            if (act == "Shoot")
            {
                if (loadout.Contains("pistol"))
                {
                    shot--;
                }

                if (shot <= 0)
                {
                    shot = 3;
                }

                ammo++;
                UncockTrigger();
            }
        }
        actions.Remove(act);
    }
示例#5
0
    void CheckHit(MapMaker.Node currentSpace, int index)
    {
        // If the shot his a wall lose 1 power
        TileScript currentTile = map.GetTileFromNode(currentSpace);

        if (currentSpace.x < basics.plannedPath[index + 1].x && !currentTile.eastViable ||
            currentSpace.x > basics.plannedPath[index + 1].x && !currentTile.westViable ||
            currentSpace.y <basics.plannedPath[index + 1].y && !currentTile.ceiling ||
                            currentSpace.y> basics.plannedPath[index + 1].y && !currentTile.floor ||
            currentSpace.z <basics.plannedPath[index + 1].z && !currentTile.northViable ||
                            currentSpace.z> basics.plannedPath[index + 1].z && !currentTile.southViable)
        {
            power--;
        }
        Debug.Log("CheckHit");
    }
示例#6
0
 void NextStep(MapMaker.Node nextStep)
 {
     if (GetComponent <CharacterStats>() != null && IsPositionOccupied(nextStep))
     {
         Debug.Log(name + " tried to step on to (" + nextStep.x + "," + nextStep.y + "," + nextStep.z + ")");
         while (shortPath.Count > shortPath.IndexOf(currentSpace))
         {
             shortPath.RemoveAt(shortPath.Count - 1);
         }
     }
     else
     {
         RpcMoveUnit(nextStep.x, nextStep.y, nextStep.z);
         AdjustFOV();
     }
 }
示例#7
0
    void CheckEachMovementTile(MapMaker.Node node)
    {
        TileScript standingTile = map.GetTileFromNode(node);

        if (standingTile.effect != null && GetComponent <CharacterStats>() != null)
        {
            switch (standingTile.effect)
            {
            case "spider":
                bonus--;
                CheckPath();
                break;

            case "python":
                if (gameObject.GetComponent <CharacterStats>() != null)
                {
                    gameObject.GetComponent <CharacterStats>().disabled = 3;
                }
                break;

            default:
                break;
            }
        }

        if (shortPath.IndexOf(node) < shortPath.Count - 1)
        {
            MapMaker.Node nextNode = shortPath[shortPath.IndexOf(node) + 1];
            if (!map.CanEnter(node.x, node.y, node.z, nextNode.x, nextNode.y, nextNode.z))
            {
                if (GetComponent <CharacterStats>() != null)
                {
                    while (shortPath.Count + 1 > shortPath.IndexOf(node))
                    {
                        shortPath.Remove(shortPath[shortPath.Count - 1]);
                    }
                }
            }
        }
    }
示例#8
0
    void Start()
    {
        node = map.graph[tileX, tileY, tileZ];
        DefenceReset();
        tt.movementcost = movementcost;
        rend            = GetComponent <MeshRenderer>();
        r = rend.material.color.r;
        g = rend.material.color.g;
        b = rend.material.color.b;

        yPos = .9f;
        if (direction == TileType.typeForArt.flat)
        {
            yPos -= .45f;
        }
        else if (direction == TileType.typeForArt.nWallFC || direction == TileType.typeForArt.nWallNone || direction == TileType.typeForArt.nwCorner)
        {
            yRot = 180;
        }
        else if (direction == TileType.typeForArt.wWallFC || direction == TileType.typeForArt.wWallNone || direction == TileType.typeForArt.swCorner)
        {
            yRot = 90;
        }
        else if (direction == TileType.typeForArt.eWallFC || direction == TileType.typeForArt.eWallNone || direction == TileType.typeForArt.neCorner)
        {
            yRot = -90;
        }
        else if (direction == TileType.typeForArt.empty && ceiling && !floor)
        {
            yPos += .45f;
        }

        if (!floor)
        {
            if (direction >= TileType.typeForArt.neCorner && direction <= TileType.typeForArt.nwCorner)
            {
                zRot += 90;
            }
            else if (ceiling && direction >= TileType.typeForArt.nWallFC && direction <= TileType.typeForArt.wWallFC)
            {
                xRot += 90;
            }
            else if (direction == TileType.typeForArt.nWallFC || direction == TileType.typeForArt.nWallNone)
            {
                zPos += .45f;
            }
            else if (direction == TileType.typeForArt.wWallFC || direction == TileType.typeForArt.wWallNone)
            {
                xPos -= .45f;
            }
            else if (direction == TileType.typeForArt.eWallFC || direction == TileType.typeForArt.eWallNone)
            {
                xPos += .45f;
            }
            else if (direction == TileType.typeForArt.sWallFC || direction == TileType.typeForArt.sWallNone)
            {
                zPos -= .45f;
            }
        }

        if (prefabName.Contains("Stair"))
        {
            if (prefabName.Contains("North"))
            {
                yRot        = 180;
                stairBottom = TileType.stairBottom.north;
            }
            else if (prefabName.Contains("West"))
            {
                yRot        = 90;
                stairBottom = TileType.stairBottom.west;
            }
            else if (prefabName.Contains("East"))
            {
                yRot        = -90;
                stairBottom = TileType.stairBottom.east;
            }
            else
            {
                stairBottom = TileType.stairBottom.south;
            }

            if (prefabName.Contains("End"))
            {
                yPos = 1f;
            }
            else
            {
                yPos += .34f;
                zPos += .09f;
            }
        }
        else
        {
            stairBottom = TileType.stairBottom.none;
        }


        gameObject.transform.localPosition = new Vector3(gameObject.transform.localPosition.x + xPos,
                                                         gameObject.transform.localPosition.y + yPos,
                                                         gameObject.transform.localPosition.z + zPos);
        gameObject.transform.localRotation = Quaternion.Euler(gameObject.transform.localRotation.x + xRot,
                                                              gameObject.transform.localRotation.y + yRot,
                                                              gameObject.transform.localRotation.z + zRot);
    }
示例#9
0
 void SpotAttack(MapMaker.Node node)
 {
     actions.Add("meleeFirst");
     meleeThis = node;
     attacking = false;
 }