void Awake() { director = SSDirector.GetInstance(); director.CurrentSceneController = this; director.CurrentSceneController.LoadResources(); actionManager = GetComponent <CCActionManager>(); }
void Start() { Debug.Log("First SceneController Start!"); gameGUI = gameObject.AddComponent <pageImage>() as pageImage; actionManager = gameObject.AddComponent <SSActionManager>() as SSActionManager; judger = gameObject.AddComponent <SSJudge>() as SSJudge; }
/** * ISceneController */ public void LoadResources() { actionManager = GetComponent <SSActionManager>(); // actionManager = new SSActionManager(); gameState = GameState.Playing; boatState = MoveState.AtSrc; river = Instantiate(Resources.Load <GameObject>("Prefabs/River")); groundSrc = Instantiate(Resources.Load <GameObject>("Prefabs/Ground"), groundPosSrc, Quaternion.identity); groundDst = Instantiate(Resources.Load <GameObject>("Prefabs/Ground"), groundPosDst, Quaternion.identity); groundLeft = Instantiate(Resources.Load <GameObject>("Prefabs/Ground"), groundPosLeft, Quaternion.identity); groundRight = Instantiate(Resources.Load <GameObject>("Prefabs/Ground"), groundPosRight, Quaternion.identity); boat = Instantiate(Resources.Load <GameObject>("Prefabs/Boat"), boatPosSrc, Quaternion.Euler(90, 90, 0)); sideSrc = new List <GameObject>(); sideDst = new List <GameObject>(); passers = new List <GameObject>(); for (var i = 0; i < cntDevil; i++) { Vector3 p = rolePosSrc - new Vector3(1 + spacingOffset, 0, 0) * i; var devil = Instantiate(Resources.Load <GameObject>("Prefabs/Devil"), p, Quaternion.identity); devil.name = "Devil"; sideSrc.Add(devil); } for (var i = 0; i < cntPriest; i++) { Vector3 p = rolePosSrc - new Vector3(1 + spacingOffset, 0, 0) * (i + 3); var priest = Instantiate(Resources.Load <GameObject>("Prefabs/Priest"), p, Quaternion.identity); priest.name = "Priest"; sideSrc.Add(priest); } }
public void Awake() { patrols = new Dictionary <int, GameObject>(); action_manager = new SSActionManager(); EventManager.StartCatchingChange += startCatching; EventManager.StopCatchingChange += stopCatching; }
public static SSActionManager GetInstance() { if (_instance == null) { _instance = new SSActionManager(); } return(_instance); }
void Awake() { SSDirector director = SSDirector.getInstance(); director.setFPS(60); director.currentSceneController = this; this.gameObject.AddComponent <UserGUI>(); actionManager = this.gameObject.AddComponent <SSActionManager>(); judgement = this.gameObject.AddComponent <Judge>(); director.currentSceneController.LoadResources(); }
public void PriestGeton() { if (this.state == State.LEFT || this.state == State.RIGHT) { if (getBoatPassenger() != 0) { if (this.state == State.LEFT) { if (priests_left.Count != 0) { GameObject temp = priests_left.Pop(); temp.transform.parent = Boat.transform; if (boatchair[0] == null) { boatchair[0] = temp; BoatFirstClass.x = Boat.transform.position.x - 1; SSActionManager.GetInstance().ApplyCCMoveToYZAction(temp, BoatFirstClass, speed); BoatIdentity[0] = Identity.PRIEST; } else { boatchair[1] = temp; BoatSecondClass.x = Boat.transform.position.x + 1; SSActionManager.GetInstance().ApplyCCMoveToYZAction(temp, BoatSecondClass, speed); BoatIdentity[1] = Identity.PRIEST; } } } else { if (priests_right.Count != 0) { GameObject temp = priests_right.Pop(); temp.transform.parent = Boat.transform; if (boatchair[0] == null) { boatchair[0] = temp; BoatFirstClass.x = Boat.transform.position.x - 1; SSActionManager.GetInstance().ApplyCCMoveToYZAction(temp, BoatFirstClass, speed); BoatIdentity[0] = Identity.PRIEST; } else { boatchair[1] = temp; BoatSecondClass.x = Boat.transform.position.x + 1; SSActionManager.GetInstance().ApplyCCMoveToYZAction(temp, BoatSecondClass, speed); BoatIdentity[1] = Identity.PRIEST; } } } } } }
// Use this for initialization void Start() { diskFac = Singleton <DiskFactory> .Instance; if (ifPhysicManager) { actionManager = gameObject.AddComponent <physicActionManager>(); } else { actionManager = gameObject.AddComponent <CCActionManager>(); } }
public void RowingBoat() { if (getBoatPassenger() != 2) { if (this.state == State.LEFT) { SSActionManager.GetInstance().ApplyCCMoveToYZAction(Boat, BoatRightPos, speed); } else if (this.state == State.RIGHT) { SSActionManager.GetInstance().ApplyCCMoveToYZAction(Boat, BoatLeftPos, speed); } } }
// 开船,直接调用SSActionManager中的方法即可 public void moveBoat() { if (boatCapacity() != 2) { if (side == 1) { SSActionManager.GetInstance().ApplyCCMoveToAction(boat_obj, boatEndPos, speed); side = 2; } else if (side == 2) { SSActionManager.GetInstance().ApplyCCMoveToAction(boat_obj, boatStartPos, speed); side = 1; } } }
public void RightGetoff() { if (this.state == State.LEFT || this.state == State.RIGHT) { if (BoatIdentity[1] != Identity.NONE) { if (BoatIdentity[1] == Identity.DEVIL) { if (this.state == State.LEFT) { devils_left.Push(boatchair[1]); Vector3 target = devilLeftPos; target.x = target.x + (3 - devils_left.Count); SSActionManager.GetInstance().ApplyCCMoveToYZAction(boatchair[1], target, speed); } else { devils_right.Push(boatchair[1]); Vector3 target = devilRightPos; target.x = target.x + (3 - devils_right.Count); SSActionManager.GetInstance().ApplyCCMoveToYZAction(boatchair[1], target, speed); } } else { if (this.state == State.LEFT) { priests_left.Push(boatchair[1]); Vector3 target = priestLeftPos; target.x = target.x + (3 - priests_left.Count); SSActionManager.GetInstance().ApplyCCMoveToYZAction(boatchair[1], target, speed); } else { priests_right.Push(boatchair[1]); Vector3 target = priestRightPos; target.x = target.x + (3 - priests_right.Count); SSActionManager.GetInstance().ApplyCCMoveToYZAction(boatchair[1], target, speed); } } boatchair[1].transform.parent = null; boatchair[1] = null; BoatIdentity[1] = Identity.NONE; } } }
// 实现上船动作,在这个过程中牧师或者魔鬼会以transform的形式到达船上 void getOnTheBoat(GameObject obj) { if (boatCapacity() != 0) { obj.transform.parent = boat_obj.transform; Vector3 target = new Vector3(); if (boat[0] == null) { boat[0] = obj; target = boat_obj.transform.position + new Vector3(-0.5f, 0.5f, 0); } else { boat[1] = obj; target = boat_obj.transform.position + new Vector3(0.5f, 0.5f, 0); } SSActionManager.GetInstance().ApplyCCMoveToYZAction(obj, target, speed); } }
public void RunAction(GameObject obj, Vector3 target, float speed, ISSActionCallback monitor) { this.obj = obj; this.target = target; this.speed = speed; this.monitor = monitor; GameSceneController.GetInstance().setMoving(true); if (target.y < obj.transform.position.y) { Vector3 targetZ = new Vector3(target.x, obj.transform.position.y, target.z); SSActionManager.GetInstance().ApplyCCMoveToAction(obj, targetZ, speed, this); } else { Vector3 targetY = new Vector3(target.x, target.y, obj.transform.position.z); SSActionManager.GetInstance().ApplyCCMoveToAction(obj, targetY, speed, this); } }
// 下船,与上船的判断类似 public void getOffTheBoat(int bside) { if (boat[bside] != null) { boat[bside].transform.parent = null; Vector3 target = new Vector3(); if (side == 1) { if (boat[bside].tag == "Priest") { priests_start.Push(boat[bside]); target = getCharacterPosition(priestStartPos, priests_start.Count - 1); } else if (boat[bside].tag == "Devil") { devils_start.Push(boat[bside]); target = getCharacterPosition(devilStartPos, devils_start.Count - 1); } } else if (side == 2) { if (boat[bside].tag == "Priest") { priests_end.Push(boat[bside]); target = getCharacterPosition(priestEndPos, priests_end.Count - 1); } else if (boat[bside].tag == "Devil") { devils_end.Push(boat[bside]); target = getCharacterPosition(devilEndPos, devils_end.Count - 1); } } SSActionManager.GetInstance().ApplyCCMoveToYZAction(boat[bside], target, speed); boat[bside] = null; } }
public void ISSActionCallback(SSAction action) { SSActionManager.GetInstance().ApplyCCMoveToAction(obj, target, speed, null); }
// Update is called once per frame void Update() { SSActionManager.Move(); }
public void OnActionCompleted(SSAction action) { SSActionManager.GetInstance().ApplyCCMoveToAction(obj, target, speed, null); }