public void Initialize(int cubeX, int cubeY, HexGrid grid, string name, GameObject mainCanvas, Text textName, Text textHP, ActionExecutor actionExecutor) { this.coordinates = new HexCoordinates(cubeX, cubeY); this.grid = grid; this.grid.SelectCell += OnCellSelected; // Bind event ownTheCell(getCurrentCell()); this.moveToCoordinate(this.coordinates.X, this.coordinates.Y); this.movingRangeWidth = 2; // Default moving range this.isReadyToMove = false; this.isReadyToAttack = false; this.healthPoint = 5; this.actionPoint = 3; this.attackWidth = 1; this.attackDamage = 1; this.characterName = name; this.moveable = true; this.isSelected = false; this.availableActions = new Dictionary <string, Action> (); this.availableActions.Add("移动", new Movement()); this.availableActions.Add("射击", new InteractiveSkill()); this.actionExecutor = actionExecutor; this.originalCharacter = this; if (this.avatarPrefab != null) { this.avatar = Instantiate(this.avatarPrefab, this.grid.transform, false); } if (this.avatar != null) { this.avatar.Initialize(cubeX, cubeY, grid, name, this, mainCanvas, textName, textHP, actionExecutor); } }
public bool IsPlayerClosest(GameObject source) { GameObject gameObject = GetClosestAgent(source); AvatarCharacter a = gameObject.GetComponent <AvatarCharacter>(); if (a == null) { return(false); } return(true); }
public void RemoveAvatar(AvatarCharacter a) { if (a.characterType == AvatarCharacter.Character.AI) { AIPlaying = false; aiAvatar.SetActive(false); } else { PlayerPlaying = false; playerAvatar.SetActive(false); } //Destroy(a.gameObject); }
public void Teleport(AvatarCharacter avatarCharacter) { int r = Random.Range(0, spawnPoints.Count); avatarCharacter.gameObject.GetComponent <Rigidbody>().MovePosition(spawnPoints[r].transform.position); }
public void KillPlayer(AvatarCharacter avatar) { if (canCapture) { } }