public CharacterController(string Myname, MySceneActionManager am) { actionManager = am; charactermodel = new CharacterModel(Myname); clickgui = charactermodel.getObject().AddComponent(typeof(ClickGUI)) as ClickGUI; clickgui.setController(this); }
//人物控制器的初始化 public ChaController(GameObject chac, int status) { character = chac; whatCharacter = status; moveable = character.AddComponent(typeof(MoveStatus)) as MoveStatus; clickGUI = character.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.setController(this); }
public int move_speed = 20; //新增移动速度 public BoatModel() { boat_pos = 0; boat = Object.Instantiate(Resources.Load("Perfabs/boat", typeof(GameObject)), new Vector3(4, 0.8F, 0), Quaternion.identity, null) as GameObject; boat.transform.Rotate(0, 90, 0, Space.Self); fromPos = new Vector3[] { new Vector3(3.5F, 1.2F, 0), new Vector3(4.5F, 1.2F, 0) }; toPos = new Vector3[] { new Vector3(-4.5F, 1.2F, 0), new Vector3(-3.5F, 1.2F, 0) }; //move = boat.AddComponent(typeof(Move)) as Move; click = boat.AddComponent(typeof(ClickGUI)) as ClickGUI; click.setBoatModel(this); }
public MyCharacterController(string which_character) { if (which_character == "priest") { character = Object.Instantiate (Resources.Load ("Perfabs/Priest", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; characterType = 0; } else { character = Object.Instantiate (Resources.Load ("Perfabs/Devil", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; characterType = 1; } moveableScript = character.AddComponent (typeof(Moveable)) as Moveable; clickGUI = character.AddComponent (typeof(ClickGUI)) as ClickGUI; clickGUI.setController (this); }
public MyCharacterController(string type) { if (type == "Priest") { character = Object.Instantiate(Resources.Load("Prefabs/Priest", typeof(GameObject)), new Vector3(3.5f, 0.75f, 0), Quaternion.identity, null) as GameObject; characterType = 0; } else { character = Object.Instantiate(Resources.Load("Prefabs/Devil", typeof(GameObject)), new Vector3(6.5f, 0.75f, 0), Quaternion.identity, null) as GameObject; characterType = 1; } clickGUI = character.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.setController(this); }
public ChaCon(string name) { if (name == "priest") { character = Object.Instantiate(Resources.Load("Perfabs/Priest", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; characterType = 0; } else { character = Object.Instantiate(Resources.Load("Perfabs/Devil", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; characterType = 1; } clickGUI = character.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.setChaCon(this); }
public Character_model(string Myname) { if (Myname == "priest") { character = Object.Instantiate(Resources.Load("Prefabs/priest", typeof(GameObject)), new Vector3(6, 0, 0), Quaternion.identity, null) as GameObject; Ctype = 0; } else { character = Object.Instantiate(Resources.Load("Prefabs/devil", typeof(GameObject)), new Vector3(6, 0, 0), Quaternion.identity, null) as GameObject; Ctype = 1; } Cmove = character.AddComponent(typeof(Move_model)) as Move_model; clickgui = character.AddComponent(typeof(ClickGUI)) as ClickGUI; clickgui.setController(this); }
public GameObjects(string Type) { MovingState = -1; if (Type == "priest") { Instance = Object.Instantiate(Resources.Load("Perfabs/Priest", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; } else { Instance = Object.Instantiate(Resources.Load("Perfabs/Devil", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; characterType = 1; } clickGUI = Instance.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.setController(this); }
public MyCharacterController(string charName) { if (charName == "Priest") { character = Object.Instantiate(Resources.Load("Prefabs/Priest", typeof(GameObject)), Vector3.zero, Quaternion.identity) as GameObject; characterType = 0; } else { character = Object.Instantiate(Resources.Load("Prefabs/Evil", typeof(GameObject)), Vector3.zero, Quaternion.identity) as GameObject; characterType = 1; } onBoat = false; clickGUI = character.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.setController(this); }
//通过字符串构造角色函数 public MyCharacterController(string c_str) { if (c_str == "priest") { is_priest = true; character = Object.Instantiate(Resources.Load("Perfabs/priest", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; } else if (c_str == "devil") { is_priest = false; character = Object.Instantiate(Resources.Load("Perfabs/devil", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; } //moveable = character.AddComponent(typeof(Moveable)) as Moveable; clickGUI = character.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.setController(this); }
public MyCharacterController(string Myname) //控制器专门创建对象 管理对象属性 { if (Myname == "priest") { character = Object.Instantiate(Resources.Load("Prefabs/Priest", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; Ctype = 0; } else { character = Object.Instantiate(Resources.Load("Prefabs/Devil", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; Ctype = 1; } //Cmove = character.AddComponent(typeof(moveable)) as moveable; clickgui = character.AddComponent(typeof(ClickGUI)) as ClickGUI; clickgui.setController(this); }
public MyCharacterController(bool Type) { characterType = Type; if (characterType) { character = Object.Instantiate(Resources.Load("Perfabs/Devil", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; } else { character = Object.Instantiate(Resources.Load("Perfabs/Priest", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; } moveScript = character.AddComponent(typeof(Move)) as Move; clickGUI = character.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.setController(this); }
public ICharacterController(int chracterType, string name) { if (chracterType == 0) { this.character = Object.Instantiate(Resources.Load("Prefabs/Priest", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; this.type = 0; } else { this.character = Object.Instantiate(Resources.Load("Prefabs/Demon", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; this.type = 1; } character.name = name; clickGUI = character.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.setController(this); }
public MyCharacterController(string Myname) { if (Myname == "priest") { character = Object.Instantiate(Resources.Load("Cube", typeof(GameObject)), Vector3.zero, Quaternion.identity) as GameObject; Ctype = 0; } else { character = Object.Instantiate(Resources.Load("Sphere", typeof(GameObject)), Vector3.zero, Quaternion.identity) as GameObject; Ctype = 1; } //Cmove = character.AddComponent(typeof(moveable)) as moveable; clickgui = character.AddComponent(typeof(ClickGUI)) as ClickGUI; clickgui.setController(this); }
public ICharacterController(string type) { if (type == "priest") { character = Object.Instantiate(Resources.Load("Perfabs/Priest", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; characterType = CharacterType.priest; } else { character = Object.Instantiate(Resources.Load("Perfabs/Devil", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; characterType = CharacterType.devil; } clickGUI = character.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.setController(this); }
public ItemControl(string type) //Instantiate { if (type == "Priest") { item = Object.Instantiate(Resources.Load("Prefabs/Priest", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; itemType = 0; } else { item = Object.Instantiate(Resources.Load("Prefabs/Devil", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; itemType = 1; } //moveable = item.AddComponent(typeof(Moveable)) as Moveable; // remove in v2 clickGUI = item.AddComponent(typeof(ClickGUI)) as ClickGUI; // add click event clickGUI.itemCtrl = this; }
public zyzCharacterController(string characterString) { if (characterString == "priest") { character = Object.Instantiate(Resources.Load("Prefabs/Priest", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; type = false; } else if (characterString == "devil") { character = Object.Instantiate(Resources.Load("Prefabs/Devil", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; type = true; } move = character.AddComponent(typeof(Move)) as Move; clickGUI = character.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.setController(this); }
public void LoadResources() { //water = new Water(Instantiate(Resources.Load("Prefabs/Water")) as GameObject); //water.SetPosition(new Vector3(0, 0.2f, 0)); //water.SetScale(new Vector3(5.6f, 0.4f, 1)); //water.Init(); coastL = new Coast(Instantiate(Resources.Load("Prefabs/Coast")) as GameObject, "left"); coastL.SetPosition(new Vector3(-4.7f, 0.5f, 0)); coastL.SetScale(new Vector3(3.8f, 1, 1)); coastL.Init(false); coastR = new Coast(Instantiate(Resources.Load("Prefabs/Coast")) as GameObject, "right"); coastR.SetPosition(new Vector3(4.7f, 0.5f, 0)); coastR.SetScale(new Vector3(3.8f, 1, 1)); coastR.Init(false); boat = new Boat(Instantiate(Resources.Load("Prefabs/Boat")) as GameObject, "boat"); boat.gameObject.AddComponent(typeof(ClickGUI)); boat.SetPosition(new Vector3(2.1f, 0.55f, 0)); boat.SetScale(new Vector3(1.4f, 0.3f, 1)); boat.Init(); for (int i = 0; i < 3; ++i) { preists[i] = new Character(Instantiate(Resources.Load("Prefabs/Preist")) as GameObject, "preist"); ClickGUI clickGUI = preists[i].gameObject.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.character = preists[i]; preists[i].clickGUI = clickGUI; preists[i].clickGUI.character = preists[i]; preists[i].SetPosition(coastR.GetEmptyPosition()); preists[i].SetScale(new Vector3(0.4f, 0.4f, 0.4f)); } for (int i = 0; i < 3; ++i) { devils[i] = new Character(Instantiate(Resources.Load("Prefabs/Devil")) as GameObject, "devil"); ClickGUI clickGUI = devils[i].gameObject.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.character = preists[i]; devils[i].clickGUI = clickGUI; devils[i].clickGUI.character = devils[i]; devils[i].SetPosition(coastR.GetEmptyPosition()); devils[i].SetScale(new Vector3(0.4f, 0.4f, 0.4f)); } }
public CharacterController(string ch_name) { if (ch_name == "priest") { obj = Object.Instantiate(Resources.Load("prefabs/priest", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; obj.transform.Rotate(Vector3.up, -90); objMark = 0; } if (ch_name == "devil") { obj = Object.Instantiate(Resources.Load("prefabs/devil", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; obj.transform.Rotate(Vector3.up, -90); objMark = 1; } move = obj.AddComponent(typeof(Move)) as Move; clickGUI = obj.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.setController(this); }
public MyCharacterController(string theCharacter) { if (theCharacter == "priest") { character = Object.Instantiate(Resources.Load("Perfabs/Priest", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; characterType = 0; } else { character = Object.Instantiate(Resources.Load("Perfabs/Devil", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; characterType = 1; } //moveableScript = character.AddComponent(typeof(Moveable)) as Moveable; //moveToAction = character.AddComponent(typeof(CCMoveToAction)) as CCMoveToAction; getBoatAction = CCGetBoatAction.GetSSAtion(character); clickGUI = character.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.setController(this); }
public ObjectController(bool witchone, int p) { if (witchone) { obj = UnityEngine.Object.Instantiate(Resources.Load("Prefabs/Man", typeof(GameObject))) as GameObject; obj.name = "Man"; MoveApi = obj.AddComponent(typeof(ObjectMove)) as ObjectMove; } else { obj = UnityEngine.Object.Instantiate(Resources.Load("Prefabs/Ghost", typeof(GameObject))) as GameObject; obj.name = "Ghost"; MoveApi = obj.AddComponent(typeof(ObjectMove)) as ObjectMove; } on_boat = false; position_inCoast = p; clickGUI = obj.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.setController(this); }
// create an object public MyCharacterController(bool is_priest_) { string prefab_str = ""; if (is_priest_) { prefab_str = "Prefabs/priest"; } else { prefab_str = "Prefabs/devil"; } character = Object.Instantiate(Resources.Load(prefab_str, typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; is_priest = is_priest_; move_script = character.AddComponent(typeof(Move)) as Move; click_gui = character.AddComponent(typeof(ClickGUI)) as ClickGUI; click_gui.setController(this); }
public MyCharacterController(string which_character) { //Resource.load()函数路径从Asset/Resource开始 //根据传入的参数which_character决定创建priest还是devil if (which_character == "priest") { character = Object.Instantiate(Resources.Load("Perfabs/Priest", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; characterType = 0; } else { character = Object.Instantiate(Resources.Load("Perfabs/Devil", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; characterType = 1; } //AddComponent为这个角色对象添加Moveable组件 moveableScript = character.AddComponent(typeof(Moveable)) as Moveable; //添加clickGUI组建 clickGUI = character.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.setController(this); }
public RoleModel(string type) { if (type == "priest") { role = Object.Instantiate(Resources.Load("Perfabs/priest1", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; role.transform.Rotate(0, 190, 0, Space.Self); roleType = 0; } else if (type == "devil") { role = Object.Instantiate(Resources.Load("Perfabs/devil1", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; role.transform.Rotate(0, 240, 0, Space.Self); roleType = 1; } else { Debug.Log("Error Type"); } //move = role.AddComponent(typeof(Move)) as Move; clickgui = role.AddComponent(typeof(ClickGUI)) as ClickGUI; clickgui.role = this; }
public MyCharacterController(string which_character) { if (which_character == "priest") { character = Object.Instantiate(Resources.Load("Perfabs/Priest", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; characterType = 0; character.transform.localRotation = Quaternion.Euler(0, 100, 0); // character.GetComponent<Renderer>().material.color = Color.white; } else { character = Object.Instantiate(Resources.Load("Perfabs/Devil", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; characterType = 1; character.transform.localRotation = Quaternion.Euler(0, 100, 0); // character.GetComponent<Renderer>().material.color = Color.red; } //moveableScript = character.AddComponent (typeof(Moveable)) as Moveable; clickGUI = character.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.setController(this); }