示例#1
0
    void Awake()
    {
        //find and set the map parent.
        map = this.GetComponentInParent <TileArrangement> ();

        tileEffects = new List <TileEffect>();
    }
示例#2
0
    public List <TileAttributes> GetPossibleMoves()
    {
        t   = moved.owner.tile;
        map = t.map;
        m   = map.tileMap;

        possibilities = new List <TileAttributes> ();

        times = new double[m.GetLength(0), m.GetLength(1)];
        paths = new List <TileAttributes> [m.GetLength(0), m.GetLength(1)];

        propogateTimes(t, timeSpent - tileTypeTimes[moved.owner.tile.type], new List <TileAttributes>());

        times [moved.owner.x, moved.owner.y] = 0;

        for (int n = 0; n < times.GetLength(0); n++)
        {
            for (int nn = 0; nn < times.GetLength(1); nn++)
            {
                if (times [n, nn] != 0)
                {
                    possibilities.Add(m [n, nn]);
                }
            }
        }

        return(possibilities);
    }
示例#3
0
    // Use this for initialization

    void Start()
    {
        initialOffset = 0.7f;
        offset        = 0.0f;

        map = GameObject.FindGameObjectWithTag("Map").GetComponent <TileArrangement> ();

        UIcamera = GameObject.Find("UI Camera");
        //originalUIpos=map.uiCameraPosition;
        UIposition = UIcamera.transform.position;
        //originalCameraSize = map.uiCameraSize;
        cameraSize     = UIcamera.GetComponent <Camera>().orthographicSize;
        initialOffset *= cameraSize / 3.5f;

        gameObject.transform.position = (new Vector3(308f / 85.75285f * cameraSize / 3.5f, 2f, -2f * cameraSize / 3.5f));//TODO: Figure out why you need such weird values.
        gameObject.transform.Translate(Vector3.Scale(new Vector3(1f, 1f, 0f), (UIposition - new Vector3(0f, 2f, 10f))));
        gameObject.transform.localScale.Set(1, 1, 1);

        foreach (Ability a in map.highlighter.chosenCharacter.specialAbilities)
        {
            AddLabel(a);
        }

        /*foreach (Ability a in map.highlighter.chosenCharacter.type.classAbilities)
         * {
         *      AddLabel (a);
         * }*/
    }
示例#4
0
 // Use this for initialization
 public override void Start()
 {
     name  = "Repair Bridge";
     specs = GetComponentInParent <ClassSpecifications> ();
     map   = GameObject.FindGameObjectWithTag("Map").GetComponent <TileArrangement>();
     breakableBridgeMat = GetComponent <MeshRenderer>().material;
 }
示例#5
0
文件: Team.cs 项目: MAKtheUnknown/KoM
 void Awake()
 {
     map          = this.GetComponentInParent <TileArrangement> ();
     manager      = this.GetComponentInParent <TeamManager> ();
     pieces       = this.GetComponentsInChildren <CharacterCharacter> ();
     activePieces = pieces.Length;
 }
示例#6
0
    public void Threat(CharacterCharacter c)
    {
        map           = GameObject.FindGameObjectWithTag("Map").GetComponent <TileArrangement>();
        enemysInRange = new List <CharacterCharacter> ();
        searchRadius  = c.type.range;

        //check characters move + attackRange
        enemysInRange = inRange(c.x, c.y, (float)searchRadius, c);
        //if list has elements
        if (enemysInRange.Count != 0)
        {
            //calculate ratio between morale and distance away
            getRatio(enemysInRange, c);
            //Move towards character with the most 'threat'
            highestThreat = getHighestThreat();
            moveTowardsHighThreat(c, highestThreat);
            if (!c.usedAbility)
            {
                useStrongestAbility(c, highestThreat);
            }
        }
        //else find the closest enemy and move towards
        else
        {
            moveTowardsHighThreat(c, findClosest(c));
        }
    }
示例#7
0
    public override void Use()
    {
        TileAttributes t = specs.owner.tile;

        if (t.north != null && t.north.containedCharacter != null)
        {
            t.north.containedCharacter.damage(1);
        }
        if (t.south != null && t.south.containedCharacter != null)
        {
            t.south.containedCharacter.damage(1);
        }
        if (t.east != null && t.east.containedCharacter != null)
        {
            t.east.containedCharacter.damage(1);
        }
        if (t.west != null && t.west.containedCharacter != null)
        {
            t.west.containedCharacter.damage(1);
        }

        map = specs.owner.tile.map;
        map.highlighter.mode    = Highlighter.SelectionMode.PIECE_TO_USE;
        specs.owner.usedAbility = true;
        cooldownTimer           = cooldown;
    }
示例#8
0
 void Awake()
 {
     map         = GetComponentInParent <TileArrangement> ();
     chosenTiles = new Stack <TileAttributes> ();
     possibleMoveHighlighters = new List <GameObject> ();
     abilitySelectorObject    = savedAbilitySelectorObject;
     abilitySelector          = abilitySelectorObject.GetComponent <AbilitySelector> ();
 }
示例#9
0
 // Use this for initialization
 public override void Start()
 {
     map               = GameObject.FindGameObjectWithTag("Map").GetComponent <TileArrangement>();
     targets           = new List <TileAttributes> ();
     charachterTargets = new List <CharacterCharacter> ();
     targetsAquired    = false;
     targetsToAquire   = numberOfTargets;
     GameObject.Destroy(GameObject.FindGameObjectWithTag("Ability Selector"));
     instructionLabel = GameObject.FindGameObjectWithTag("Ability Instructions").GetComponentInChildren <Text>();
 }
示例#10
0
文件: Move.cs 项目: MAKtheUnknown/KoM
    public Move(GameObject subject, TileAttributes source, TileAttributes target, double speed)
    {
        this.subject = subject;
        sourceX      = source.x;
        sourceY      = source.y;
        targetX      = target.x;
        targetY      = target.y;
        this.speed   = speed;
        direction    = (new Vector3((float)(targetX - sourceX), (float)(targetY - sourceY), 0.0f));
        direction    = direction.normalized;
        direction.Scale(new Vector3((float)speed, (float)speed, (float)speed));

        map = target.map;
    }
示例#11
0
 // Use this for initialization
 void Start()
 {
     map = GameObject.FindGameObjectWithTag("Map").GetComponentInChildren <TileArrangement>();
 }
示例#12
0
 // Use this for initialization
 public override void Start()
 {
     name  = "Inspiring Presence";
     specs = GetComponentInParent <ClassSpecifications> ();
     map   = GameObject.FindGameObjectWithTag("Map").GetComponent <TileArrangement>();
 }
示例#13
0
 void Awake()
 {
     map       = this.GetComponentInParent <TileArrangement> ();
     teams     = this.GetComponentsInChildren <Team> ();
     threatDet = this.GetComponentInChildren <ThreatDetermination>();
 }