// Start is called before the first frame update public virtual void Init(ActPlayerController controller) { _camera = GetComponent <Camera>(); isFollowPlayer = true; _currentZoom = MinimumZoom; if (controller.Pawn == null) { return; } AssignTarget(controller.Pawn); // if (OldGameMain.GetInstance().gameMode != null) { _levelBounds = OldGameMain.GetInstance().gameMode.GetLevelBound(); } _lastTargetPosition = Target.position; _offsetZ = (transform.position - Target.position).z; transform.parent = null; if (PixelPerfect) { } else { Zoom(); } }
public void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Reactor") { MapReactor reactor = collision.GetComponent <MapReactor>(); if (!ActivateReactors.Contains(reactor)) { ActivateReactors.Add(reactor); OldGameMain.GetInstance().gameMode.HudRoot.ShowReactHud(reactor); } } }
// Update is called once per frame void Update() { InputMdl.Tick(Time.deltaTime); if (AllowInteract() && InputMdl.Interact) { if (ActivateReactors.Count > 0) { string actionString = ActivateReactors[0].actionString; if (actionString == "map") { OldGameMain.GetInstance().SwitchScene("map01"); } } } //if (InputMdl.Throw && Pawn.AllowUseSkill() ) //{ // Pawn.ThrowChain(); //} //if (InputMdl.Jump && Pawn.AllowJump()) //{ // //没有攻击动作 // Pawn.Jump(); //} //if (Pawn.isClimbing) //{ // Pawn.ClimbMove(InputMdl.DVertical); //} //else //{ // if (InputMdl.DVertical > 0) // { // if (Pawn.AllowClimb()) // { // Collider2D c = Pawn.GetClimbingColliderAbove(); // if (c != null) // { // Pawn.StartClimb(c); // } // } // } //} MoveH = InputMdl.DLateral; MoveV = InputMdl.DVertical; WantJump = InputMdl.Jump; WantDash = InputMdl.Dash; }
public void OnTriggerExit2D(Collider2D collision) { if (collision.tag == "Reactor") { MapReactor reactor = collision.GetComponent <MapReactor>(); if (ActivateReactors.Contains(reactor)) { int idx = ActivateReactors.IndexOf(reactor); ActivateReactors.Remove(reactor); OldGameMain.GetInstance().gameMode.HudRoot.HideReactHud(idx); } } }
// Use this for initialization void Start() { Pawn = GetComponent <ActCharacter>(); Pawn.controller = this; gameMode = OldGameMain.GetInstance().gameMode; bt = GetComponent <BehaviorTree>(); //BehaviorManager.instance.UpdateInterval = UpdateIntervalType.SpecifySeconds; //BehaviorManager.instance.UpdateIntervalSeconds = 0.25f; //BehaviorManager.instance.ExecutionsPerTick = BehaviorManager.ExecutionsPerTickType.Count; //BehaviorManager.instance.task //SharedInt i1 = bt.GetVariable("s") as SharedInt; //i1.Value = 1; //bt.EnableBehavior(); //bt.RegisterEvent<object>("MyEvent", ReceivedEvent); //bt.UnregisterEvent<object>("MyEvent", ReceivedEvent); }