Inheritance: MonoBehaviour
Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     ps = gameObject.GetComponent<PlayerStats> ();
     sc = gameObject.GetComponent<StateController> ();
     tpb = gameObject.GetComponent<TestPlayerBehaviour> ();
     buffSetup ();
 }
Beispiel #2
0
    void Start()
    {
        _stateCont = StateController.Instance;
        // Set the select controller to selection initially
        _stateCont.ControllerState = ControllerState.Selection;
        // and set the select type to mob
        _stateCont.GetController<SelectController>().ControllerSelectType = SelectController.SelectState.Mob;

        for (int i = 0; i < BuildingList.Instance.buildings.Length; i++)
        {
            Transform t = Instantiate(buildingGridPrefab) as Transform;
            t.parent = buildingGrid.transform;
            t.localScale = new Vector3(1, 1, 1);
            t.localPosition = Vector3.zero;
            t.GetComponent<UILabel>().text = BuildingList.Instance.buildings[i].GetComponent<BuildingInfo>().BuildingName;

            Building _prefabRef = BuildingList.Instance.buildings[i];
            Transform _previewRef = BuildingList.Instance.BuildingMeshPreviewPrefabs[i];
            EventDelegate.Add(t.GetComponent<UIButton>().onClick, () =>
            {
                _stateCont.ControllerState = ControllerState.Building;
                // Set the building prefab
                _stateCont.GetController<BuildingPlaceController>().BuildingPrefab = _prefabRef.transform;
                // Set the building display
                _stateCont.GetController<BuildingPlaceController>().BuildingPreview = _previewRef;

            });

        }

        buildingGrid.Reposition();
    }
Beispiel #3
0
    void Start()
    {
        Player = GameObject.Find ("Controller");
        End = GameObject.Find ("End");

        state = GameObject.Find("StateController").GetComponent<StateController>();
    }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        StateController stateController = new StateController();
        stateController.InitializeGameState();

        Debug.Log("The game state is: " + stateController.GetGameState().ToString());
    }
Beispiel #5
0
 void Start()
 {
     GameObject control = GameObject.Find ("Controller");
     startPos = control.transform.position;
     startRot = control.transform.rotation;
     keyStartPos = GameObject.Find ("Key").transform.position;
     state = GameObject.Find("StateController").GetComponent<StateController>();
 }
Beispiel #6
0
    void Start()
    {
        state = GameObject.Find("StateController").GetComponent<StateController>();
        positions = new ArrayList ();
        rotations = new ArrayList ();
        End = GameObject.Find ("End");

        maxHealth = health;
    }
Beispiel #7
0
    // Use this for initialization
    void Start()
    {
        Debug.Log("starting resume button");

        state = GameObject.Find("StateController").GetComponent<StateController>();

        button = transform.GetComponent<Button>();
        button.onClick.AddListener(() => { state.pause();});
    }
 void Awake()
 {
     if (instance != null && this != instance)
     {
         Destroy(transform.gameObject);
         return;
     }
     DontDestroyOnLoad(transform.gameObject);
     instance = this;
 }
Beispiel #9
0
    void OnTriggerStay(Collider coll)
    {
        IEnumerator entities = BoltNetwork.entities.GetEnumerator ();
        if (coll.gameObject.tag == "grass") {
            if (Input.GetKeyDown (tpb.tailSlapKey)) {
                TailSlapUsedInHidingGrass = true;
            }
        }
        if (coll.gameObject.tag == "player") {
            sc = gameObject.GetComponentInParent<StateController> ();
            ps = gameObject.GetComponentInParent<PlayerStats> ();
            if (Input.GetKeyDown (tpb.tailSlapKey) && ! sc.isStunned && sc.canMove && !sc.isChanneling && !sc.isDead) {

                GameObject go = GameObject.Find ("Canvas");
                HUDScript hs = go.GetComponentInChildren<HUDScript> ();

                hs.announcementText.text = "Miss";
                while (entities.MoveNext()) {
                    if (entities.Current.GetType ().IsInstanceOfType (new BoltEntity ())) {
                        BoltEntity be = (BoltEntity)entities.Current as BoltEntity;
                        // Create Event and use the be, if it is the one that is colliding.

                        if (be.gameObject == coll.gameObject) { // Check for enemy, deal full damage
                            if (available) {
                                Debug.Log ("SLAPPING DA TAIL");
                                if (coll.gameObject.GetComponent<PlayerStats> ().teamNumber != this.gameObject.GetComponentInParent<PlayerStats> ().teamNumber) {
                                    // deal full damage!!!
                                    var evnt = TailSlapEvent.Create(Bolt.GlobalTargets.Everyone);
                                    hs.announcementText.text = "" + this.gameObject.GetComponentInParent<PlayerStats>().tailSlapDamage;
                                    evnt.TargEnt = be;
                                    evnt.Damage = this.gameObject.GetComponentInParent<PlayerStats>().tailSlapDamage;
                                    evnt.Send();
                                } else if (!be.isOwner) {
                                    //Do nothing.
                                } else { // check for friendly player, deal 50% dmg.
                                    // deal half damage!!!
                                    var evnt = TailSlapEvent.Create(Bolt.GlobalTargets.Everyone);
                                    hs.announcementText.text = "" + this.gameObject.GetComponentInParent<PlayerStats>().tailSlapDamage / 2;
                                    evnt.TargEnt = be;
                                    evnt.Damage = this.gameObject.GetComponentInParent<PlayerStats>().tailSlapDamage / 2;
                                    evnt.Send();
                                }

                                available = false;
                                lastUsed = Time.time;
                            }

                            //  Debug.Log("BoltEntity.gameObject matches coll.gameObject");

                        }
                    }
                }
            }
        }
    }
Beispiel #10
0
        public MainEngine(MainSystemTray form)
        {
            //Fetch the list of commands
            commandList = SettingsSingleton.Instance().Commands;
            // Create the speech recognition engine
            speechRecognizer = createSpeechRecogntionEngine(form);

            stateController = new StateController();

            //Register to the event that provides the fixations
            EventSingleton.Instance().fixationEvent += sharedData_fixationEvent;
            //Register to the event that fires when keyboard keys are pressed
            EventSingleton.Instance().systemHook.KeyDown += sharedData_keyboardEvent;
            speechRecognizer.SpeechRecognized += SpeechRecognised;
        }
Beispiel #11
0
 void start()
 {
     sc = this.gameObject.GetComponentInParent<StateController> ();
     ps = this.gameObject.GetComponentInParent<PlayerStats> ();
     tpb = this.gameObject.GetComponentInParent<TestPlayerBehaviour> ();
 }
Beispiel #12
0
 // Use this for initialization
 void Start()
 {
     sc = GameObject.Find("StateController").GetComponent<StateController>();
 }
 // The decide function, called on Update() (State controller - current state - transition - decision).
 public override bool Decide(StateController controller)
 {
     return(controller.variables.feelAlert);
 }
Beispiel #14
0
 public override void Act(StateController controller)
 {
     Patrol(controller);
 }
Beispiel #15
0
 private void exit(StateController controller)
 {
     controller.resetSkill();
 }
Beispiel #16
0
        private void Send(string message,StateController.State state = StateController.State.Game)
        {
            string sendedIp = _state.GetIp(state);
                if (sendedIp == null)
                throw new NullReferenceException();

            _worker.SendMessage(message,sendedIp);
        }
Beispiel #17
0
 public override bool Decide(StateController controller)
 {
     return(Breakfree(controller));
 }
Beispiel #18
0
    public override bool Decide(StateController controller)
    {
        bool chaseTargetIsActive = controller.chaseTarget.gameObject.activeSelf;

        return(chaseTargetIsActive);
    }
Beispiel #19
0
    // 用于敌人 AI 在前往房子的过程中做决策
    public override bool Decide(StateController controller)
    {
        bool encounter = Walk(controller);

        return(encounter);
    }
Beispiel #20
0
    public override bool Decide(StateController controller)
    {
        bool noEnemyInSight = Search(controller);

        return(noEnemyInSight);
    }
 public override bool Test(StateController p_controller)
 {
     return(p_controller.CheckCountdown(m_time));
 }
 public override void Act(StateController controller)
 {
     controller.boid.Flock();
 }
Beispiel #23
0
 public override void OnExit(StateController controller)
 {
     exit(controller);
 }
Beispiel #24
0
 public override bool Decide(StateController controller)
 {
     return(InRangeSphere(controller));
 }
 void Awake()
 {
     sc = GameObject.Find("StateController").GetComponent<StateController>();
     playerInfo = GameObject.Find("GameContent").GetComponent<PlayerInformation>();
 }
Beispiel #26
0
 public void Change_State(StateController <PlayerUnder> State)
 {
     UnderStateChange.Change_State(State);
 }
Beispiel #27
0
 private bool Scan(StateController controller)
 {
     controller.navMeshAgent.isStopped = true;
     controller.transform.Rotate(0, controller.enemyStats.searchingTurnSpeed * Time.deltaTime, 0);
     return(controller.CheckIfCountDownElapsed(controller.enemyStats.searchDuration));
 }
Beispiel #28
0
 public override bool Decide(StateController controller)
 {
     return(CheckToyStatus(controller));
 }
		public AppState(Scene scene, StateController controller, Core.State state)
		{
			this.scene = scene;
			this.controller = controller;
			this.state = state;
			this.name = state.name;
		}
 public void UpdateState(StateController controller)
 {
     DoActions(controller);
     CheckTransitions(controller);
 }
	public override bool Test(StateController p_controller) {
		bool finished = p_controller.m_patrolFinished;

		return finished;
	}
Beispiel #32
0
    float overTime = 1.2f;  // 連続攻撃の受付終了時間(秒)

    //MonoBehaviourでのStart()メソッドと同じ
    //新しいステートに移り変わった時に実行
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        //プレイヤーのステートコントローラーの取得
        state     = GameObject.Find("Player").GetComponent <StateController>();
        deltaTime = 0f;
    }
Beispiel #33
0
    void Start()
    {
        ct = new Controller();
        ct.EnableGesture(Gesture.GestureType.TYPESWIPE);
        ct.EnableGesture(Gesture.GestureType.TYPECIRCLE);
        ct.EnableGesture(Gesture.GestureType.TYPESCREENTAP);
        ct.Config.Save();

        descriptions = new List<string>(new string[] { sinoDesc, discoDesc });

        sc = new StateController(controlPanel, optionsPanel, successPanel, congratzPanel, soundIcon,
                                 successSound, descriptionText, previewImages, leapMotionObject, discoCamera);

        sc.addLabObject(sino, descriptions[0]);
        sc.addLabObject(discodelezenne, descriptions[1]);
    }
Beispiel #34
0
 private void Chase(StateController controller)
 {
     controller._navMeshAgent.destination = controller.chaseTarget.position;
     controller._navMeshAgent.isStopped   = false;
 }
Beispiel #35
0
 void Awake()
 {
     bi = this.GetComponent<BuildingInformation>();
     sc = GameObject.Find("StateController").GetComponent<StateController>();
 }
Beispiel #36
0
 public override void Act(StateController controller)
 {
     Chase(controller);
 }
Beispiel #37
0
 public override bool Decide(StateController controller)
 {
     return(controller.isIdle);
 }
Beispiel #38
0
    public override bool Decide(StateController controller)
    {
        bool targetVisible = Look(controller);

        return(targetVisible);
    }
Beispiel #39
0
 void Update()
 {
     tpb = this.gameObject.GetComponentInParent<TestPlayerBehaviour> ();
     sc = this.gameObject.GetComponentInParent<StateController> ();
     if ((Time.time - lastUsed) >= gameObject.GetComponentInParent<PlayerStats> ().tailSlapCooldown) {
         available = true;
     }
     if (Input.GetKeyDown (tpb.tailSlapKey) && !sc.isStunned && !sc.isChanneling && !sc.isDead) {
         var evnt = TailAnimEvent.Create(Bolt.GlobalTargets.Everyone);
         evnt.TargEnt = GetComponentInParent<TestPlayerBehaviour>().entity;
         evnt.Send();
     //			GetComponentInParent<TestPlayerBehaviour> ().animation.Play ("M_TS");
     }
 }
Beispiel #40
0
 public abstract void OnStart(StateController controller);
Beispiel #41
0
 // Use this for initialization
 void Start()
 {
     //coconut = BoltNetwork.Attach (BoltPrefabs.Coconut_1) as GameObject;
     //GameObject.Find ("Coconut 1(Clone)");
     //coconut = GameObject.Find ("Coconut 1(Clone)");
     //nut = coconut.GetComponent<Coconut> ();
     //Debug.Log ("Coconut: " + coconut + ", nutScript: " + nut);
     sc = this.gameObject.GetComponent<StateController> ();
     ps = this.gameObject.GetComponent<PlayerStats> ();
     nutId = (GameObject.FindWithTag ("nut")as GameObject).GetInstanceID ();
     coconut = GameObject.FindWithTag ("nut") as GameObject;
 }
 private void Jump(StateController controller, float jumpPower)
 {
     Debug.Log("Jumping!");
     controller.rb.velocity += new Vector2(10f, jumpPower);
     //rb.AddForce(Vector2.up * jumpPower, ForceMode2D.Impulse);
 }
    // Use this for initialization
    void Start()
    {
        player = this.gameObject;
            timeSinceLastBoom = Time.time;
            wasd = gameObject.GetComponent<WASD> ();
            sc = gameObject.GetComponent<StateController> ();
            ps = gameObject.GetComponent<PlayerStats> ();
            sound = gameObject.GetComponent<SoundController> ();
            coconut = GameObject.FindGameObjectWithTag ("nut");

            //ANIMATIONS
            animation = this.gameObject.GetComponent<Animation> ();
            animation.wrapMode = WrapMode.Loop;

            walk = animation ["M_Walk"];
            death = animation ["M_Death"];
            buffAnim = animation ["M_Buff"];
            jump1 = animation ["M_Jump1"];
            jump2 = animation ["M_Jump2"];
            tail = animation ["M_TS"];
            boom = animation ["M_BM"];
            puke_start = animation ["M_BP_Start"];
            puke_end = animation ["M_BP_End"];
            fish = animation ["M_FS"];

            //      AnimationClip ac = animation.GetClip("M_Death");
            //      Debug.Log(ac.name);
            //animation.CrossFade("M_Death",0.25f);
            //idle = animation["M_Death"];
            //animation.Play("M_Death");
            animation ["M_Walk"].speed = 4;
            animation ["M_Walk"].layer = 0;
            animation ["M_Death"].wrapMode = WrapMode.Once;
            animation ["M_Death"].layer = 1;
            animation ["M_Jump1"].wrapMode = WrapMode.Once;
            animation ["M_Jump1"].speed = 2;
            animation ["M_Jump1"].layer = 1;
            animation ["M_Jump2"].wrapMode = WrapMode.Once;
            animation ["M_Jump2"].speed = 2;
            animation ["M_Jump2"].layer = 1;
            animation ["M_TS"].wrapMode = WrapMode.Once;
            animation ["M_TS"].speed = 2;
            animation ["M_TS"].layer = 1;
            animation ["M_BM"].wrapMode = WrapMode.Once;
            animation ["M_BM"].speed = 3;
            animation ["M_BM"].layer = 1;
            animation ["M_FS"].wrapMode = WrapMode.Once;
            animation ["M_FS"].speed = 1;
            animation ["M_FS"].layer = 1;
            animation ["M_BP_Start"].wrapMode = WrapMode.Once;
            animation ["M_BP_Start"].speed = 1;
            animation ["M_BP_Start"].layer = 1;
            animation ["M_BP_End"].wrapMode = WrapMode.Once;
            animation ["M_BP_End"].speed = 1;
            animation ["M_BP_End"].layer = 1;

            KeyCode[] bindings = MenuScript.KeyBindings;
            tailSlapKey = bindings [0];
            boomNanaKey = bindings [1];
            aoeKey = bindings [2];
            ccKey = bindings [3];
            cprKey = bindings [4];
    }
Beispiel #44
0
 // Use this for initialization
 void Start()
 {
     sc = game.GetComponent<StateController>();
 }
Beispiel #45
0
    public override bool Decide(StateController controller)
    {
        bool noEnemyInsight = Scan(controller);

        return(noEnemyInsight);
    }
 // Use this for initialization
 void Start()
 {
     sc = GameObject.Find("StateController").GetComponent<StateController>();
     mainBuilding = GameObject.FindGameObjectWithTag("MainBuilding");
 }
Beispiel #47
0
 public static StateController Fixture()
 {
     StateController controller = new StateController(new StateRepository(), "", new LoginView());
     return controller;
 }
 public override void Act(StateController controller)
 {
     Attack(controller);
 }
 // Use this for initialization
 void Start()
 {
     bi = GetComponent<BuildingInformation>();
     stateControl = GameObject.Find("StateController").GetComponent<StateController>();
 }
Beispiel #50
0
 public override void Act(StateController controller)
 {
     Dash(controller);
 }
Beispiel #51
0
 public abstract void Act(StateController controller);
    private void Patrol(StateController controller)
    {
        jumpTimer += Time.deltaTime;
        //forward raycast
        RaycastHit2D hit;

        if (controller.faceRight)
        {
            lineCastPosition = controller.transform.position + controller.transform.right * controller.width;
            //lineCastPosition = controller.transform.position;
            hit = Physics2D.Raycast(lineCastPosition, Vector2.right);
            //Debug.DrawRay(lineCastPosition, Vector2.right, Color.red);
        }
        else
        {
            lineCastPosition = controller.transform.position + controller.transform.right * controller.width;
            //lineCastPosition = controller.transform.position;
            hit = Physics2D.Raycast(lineCastPosition, -Vector2.right);
            //Debug.DrawRay(lineCastPosition, -Vector2.right, Color.red);
        }

        //checks if enemy is grounded
        grounded = isGrounded(lineCastPosition);
        //Debug.Log(grounded);
        //Debug.Log(controller.rb.velocity.magnitude);
        //Debug.Log(hit.collider.name + ", " + Mathf.Abs(Vector2.Distance(controller.transform.position, hit.collider.transform.position)));
        float distanceFromHit = Mathf.Abs(Vector2.Distance(controller.transform.position, hit.collider.transform.position));

        if (hit.collider.tag == "Obstacle" &&
            grounded &&
            jumpTimer > jump &&
            distanceFromHit < 1.5f)
        {
            jumpTimer = 0f;
            //Debug.Log("Raycast hit an obstacle");
            Jump(controller, 6f);
        }
        else if (hit.collider.name == "TallObstacle" &&
                 grounded &&
                 jumpTimer > jump &&
                 distanceFromHit < 1.5f)
        {
            jumpTimer = 0f;
            Jump(controller, 10f);
        }
        else if (hit.collider.name.Contains("RightWall") &&
                 distanceFromHit < controller.distanceFromWall)
        {
            //controller.transform.localRotation = Quaternion.Euler(0, 180, 0);
            controller.faceRight = false;
            controller.Flip(controller.faceRight);
        }
        else if (hit.collider.name.Contains("LeftWall") &&
                 distanceFromHit < controller.distanceFromWall)
        {
            //controller.transform.localRotation = Quaternion.Euler(0, 0, 0);
            controller.faceRight = true;
            controller.Flip(controller.faceRight);
        }

        Move(controller);
        Stuck(controller);
    }
Beispiel #53
0
 // Use this for initialization
 void Start()
 {
     sc = this.gameObject.GetComponentInParent<StateController> ();
     ps = this.gameObject.GetComponentInParent<PlayerStats> ();
     tickTimer = sc.globalCooldownTime;
 }
Beispiel #54
0
 public abstract void OnExit(StateController controller);
 void Attack(StateController controller)
 {
     Debug.Log("I am attacking");
 }
Beispiel #56
0
 public Player(int x) {
     _multiplayerController = GameObject.Find("Board").GetComponent<StateController>();
     PlayerId = x;
     MoneyAmount = 500;
 }