public ArrayList Neighbours( Moveable peep) { Character peepChar = peep.gameObject.GetComponent<Character> (); bool peepCanPathThroughEnemies = peep.canPathThroughEnemies; ArrayList neighbourhood = new ArrayList (); if (left != null && !peep.unpathables.Contains(left.GetComponent<HexTile>().Type) && ( peepCanPathThroughEnemies || !ArrayListsIntersect( left.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams))) neighbourhood.Add (left); if (right != null && !peep.unpathables.Contains(right.GetComponent<HexTile>().Type) && ( peepCanPathThroughEnemies || !ArrayListsIntersect( right.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams))) neighbourhood.Add (right); if (up_left != null && !peep.unpathables.Contains(up_left.GetComponent<HexTile>().Type) && ( peepCanPathThroughEnemies || !ArrayListsIntersect( up_left.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams))) neighbourhood.Add (up_left); if (up_right != null && !peep.unpathables.Contains(up_right.GetComponent<HexTile>().Type) && ( peepCanPathThroughEnemies || !ArrayListsIntersect( up_right.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams))) neighbourhood.Add (up_right); if (down_right != null && !peep.unpathables.Contains(down_right.GetComponent<HexTile>().Type) && ( peepCanPathThroughEnemies || !ArrayListsIntersect( down_right.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams))) neighbourhood.Add (down_right); if (down_left != null && !peep.unpathables.Contains(down_left.GetComponent<HexTile>().Type) && ( peepCanPathThroughEnemies || !ArrayListsIntersect( down_left.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams))) neighbourhood.Add (down_left); return neighbourhood; }
public static void Hitdetecion(Moveable obj, Misc.Quad[,] objlist) { foreach(Misc.Quad xobj in objlist) { if(obj.Bounds.IntersectsWith(obj.Bounds)) { obj.Direction = new OpenTK.Vector2(0, 0); } } }
void Awake() { rb2d = GetComponent<Rigidbody2D>(); anim = GetComponent<Animator>(); movement = GetComponent<Moveable>(); spriteRenderer = GetComponent<SpriteRenderer>(); weaponManager = GetComponent<WeaponManager>(); }
void Start() { this.personObj = this.gameObject; this.personTra = this.transform; this.moveable = this.GetComponent<Moveable>(); this.serverPos = this.personTra.position; this.serverRot = this.personTra.localEulerAngles.y; }
public static void Hitdetecion(Moveable player1, Ground[,] objlist) { foreach(Ground obj in objlist) { if(player1.Bounds.IntersectsWith(obj.Bounds) && obj.Isfilled) { //middle region if(((player1.CenterY) > (obj.CenterY - (obj.Height / 2))) && ((player1.CenterY) < (obj.CenterY + (obj.Height / 2)))) { //left region if(player1.CenterX < obj.CenterX) { player1.Position = player1.Position + new OpenTK.Vector3(-1, 0, 0); } //rigth region if(player1.CenterX > obj.CenterX) { player1.Position = player1.Position + new OpenTK.Vector3(1, 0, 0); } } //upper region else if(player1.CenterY > obj.CenterY) { ////left region //if(player1.Center.X < obj.X + obj.X){ // player1.Position = player1.Position + new OpenTK.Vector3(-1, 1, 0); //} //middle region if(((player1.CenterX) > (obj.CenterX - (obj.Height / 2))) && ((player1.CenterX) < (obj.CenterX + (obj.Width / 2)))) { player1.Position = player1.Position + new OpenTK.Vector3(0, 1, 0); } ////rigth region //if(player1.Center.X < (obj.X + obj.Width)){ // player1.Position = player1.Position + new OpenTK.Vector3(1, -1, 0); //} } //lower region else if(player1.CenterY < obj.CenterY) { ////left region //if(player1.Center.X < obj.X + obj.X){ // player1.Position = player1.Position + new OpenTK.Vector3(-1, -1, 0); //} //middle region if(((player1.CenterX) > (obj.CenterX - (obj.Height / 2))) && ((player1.CenterX) < (obj.CenterX + (obj.Width / 2)))) { player1.Position = player1.Position + new OpenTK.Vector3(0, -1, 0); } ////rigth region //if(player1.Center.X < (obj.X + obj.Width)){ // player1.Position = player1.Position + new OpenTK.Vector3(1, -1, 0); //} } } } }
void Awake() { rb2d = GetComponent<Rigidbody2D>(); anim = GetComponent<Animator>(); movement = GetComponent<Moveable>(); playerTransform = GameObject.Find("Player").transform; // init body damage bodyWeapon.BroadcastMessage("InitDamage", attack); bodyWeapon.BroadcastMessage("InitPushForce", pushForce); }
protected void Awake() { _moveable = GetComponent<Moveable>(); _weapon = GetComponent<Weapon>(); _player = GetComponent<Player>(); //pNo = PlayerPrefs.GetInt("NumPlayers")-_player.playerNumber; //set up defaults set at the join screen //vertLookInvert = PlayerPrefs.GetInt("P"+_player.playerNumber+"Inverted"); //print("set inerted " + pNo + " " + vertLookInvert); sensitivityScale = 1;//PlayerPrefs.GetFloat("P"+_player.playerNumber+"sensitivityScale"); }
public Dictionary<HexTile, HexTile> GetPathToTile( Moveable peep, HexTile source, HexTile destination) { Dictionary<HexTile, HexTile> cameFrom = new Dictionary<HexTile, HexTile>(); Dictionary<HexTile, int> costSoFar = new Dictionary<HexTile, int>(); var frontier = new PriorityQueue<HexTile>(); frontier.Enqueue(source, 0); cameFrom[source] = source; costSoFar[source] = 0; while (frontier.Count > 0) { var current = frontier.Dequeue(); if (current.Equals(destination)) { break; } foreach (var next in current.Neighbours( peep)) { GameObject nextObj = (GameObject) next; HexTile nextTile = nextObj.GetComponent<HexTile>(); int newCost = costSoFar[current] + Cost( current, nextTile); if (!costSoFar.ContainsKey(nextTile) || newCost < costSoFar[nextTile]) { costSoFar[nextTile] = newCost; int priority = newCost + Heuristic(nextTile, destination); frontier.Enqueue(nextTile, priority); cameFrom[nextTile] = current; } } } return cameFrom; }
// Rechables pseudocode /* function cube_reachable(start, movement): var visited = set() add start to visited var fringes = [] fringes.append([start]) for each 1 < k ≤ movement: fringes.append([]) for each cube in fringes[k-1]: for each 0 ≤ dir < 6: var neighbor = cube_neighbor(cube, dir) if neighbor not in visited, not blocked: add neighbor to visited fringes[k].append(neighbor) return visited */ public ArrayList reachables( Moveable peep, HexTile root) { ArrayList visited = new ArrayList (); // list of visited noted visited.Add (root); // add root for obvious reasons ArrayList fringes = new ArrayList ( peep.range + 1); // list of lists // fringes[k] = all nodes reachable in k fringes.Add (new ArrayList() { root}); // add [ root] to fringes[ 0] for (int i = 1; i <= peep.range; i++) { fringes.Add( new ArrayList()); foreach( HexTile tile in (ArrayList)fringes[ i-1]) { foreach( GameObject neighbourGO in tile.Neighbours( peep)) { HexTile neighbour = neighbourGO.GetComponent<HexTile>(); if ( !visited.Contains( neighbour)) { visited.Add ( neighbour); ((ArrayList) fringes[ i]).Add(neighbour); } } } } return visited; }
void ShowPathToTile( Moveable peep, HexTile source, HexTile destination) { }
// show all paths // this should highlight all available destinations the current character can go to. void ShowAllPaths( Moveable peep, HexTile root, int depth) { }
/// <summary> /// Returns true if DesignerBlockBean instances are equal /// </summary> /// <param name="input">Instance of DesignerBlockBean to be compared</param> /// <returns>Boolean</returns> public bool Equals(DesignerBlockBean input) { if (input == null) { return(false); } return (( Type == input.Type || (Type != null && Type.Equals(input.Type)) ) && ( Inline == input.Inline || (Inline != null && Inline.Equals(input.Inline)) ) && ( Moveable == input.Moveable || (Moveable != null && Moveable.Equals(input.Moveable)) ) && ( Disabled == input.Disabled || (Disabled != null && Disabled.Equals(input.Disabled)) ) && ( Deletable == input.Deletable || (Deletable != null && Deletable.Equals(input.Deletable)) ) && ( Editable == input.Editable || (Editable != null && Editable.Equals(input.Editable)) ) && ( Comment == input.Comment || (Comment != null && Comment.Equals(input.Comment)) ) && ( Mutation == input.Mutation || Mutation != null && Mutation.SequenceEqual(input.Mutation) ) && ( Children == input.Children || Children != null && Children.SequenceEqual(input.Children) ) && ( Fields == input.Fields || Fields != null && Fields.SequenceEqual(input.Fields) ) && ( Next == input.Next || (Next != null && Next.Equals(input.Next)) )); }
internal bool doDispell(Moveable m, double gameTime) { m.removeBuffType(BuffType.physicalDOT); return true; }
internal override void setTarget(Moveable m, double gameTime) { //bigHealTarget = m; }
void Start(){ mov = gameObject.GetComponent<Moveable>(); }
public Marine(Moveable moveable, Attackable attackable) : base(moveable, attackable) { }
public MoveLeft(Moveable m) { this.move = m; history = new Stack <Vector3>(); }
private void UpdateRefference() { m_Moveable = GetComponent <Moveable>(); }
public UpdateModel3DCommand(Moveable parameters) : base("update", parameters) { }
internal bool doBuffCD(double gameTime, Moveable m) { m.addBuff(new Buff(gameTime, BuffType.CDreduc, BUFF_TIME, BUFF_CD_PERCENT)); return true; }
protected override void UpdateREF() { base.UpdateREF(); moveable = GetComponent <Moveable>(); }
internal bool doBigHeal(Moveable m) { m.heal(BIGHEAL_AMT); return true; }
internal bool doBuffDmg(double gameTime,Moveable m) { m.addBuff(new Buff(gameTime, BuffType.meleeDmg, BUFF_TIME, BUFFDMG_AMT)); return true; }
internal bool doHeal(Moveable m) { m.heal(AOEHEAL_AMT); return true; }
public Model3DCommand(string type, Moveable parameters) : base(type, parameters) { }