Ejemplo n.º 1
0
 void Awake()
 {
     feeding = false;
     foodSource = GameObject.FindWithTag("Foodsource");
     _testMovement = gameObject.GetComponent<TestMovement>();
     //Increase the agent's hunger level every 5 seconds
 }
Ejemplo n.º 2
0
    public void Respawn()
    {
        // Reset gravity cubes on respawn
        GravityCubeController[] gravityCubes = FindObjectsOfType(typeof(GravityCubeController)) as GravityCubeController[];
        foreach (GravityCubeController gc in gravityCubes)
        {
            gc.ResetTrigger();
        }

        // Respawn with max health???
        health = maxHealth;
        healthBar.setValue(health);
        respawning = true;
        player.SetActive(false);
        //yield return new WaitForSeconds(1);
        player.transform.position = spawnpoint;
        player.transform.up       = up;
        GravityController playerGravityController = this.GetComponent <GravityController>();

        playerGravityController.SetGravity(-up);

        // lose coins
        TestMovement tm = player.GetComponent <TestMovement>();

        tm.decreaseScore();

        player.SetActive(true);
        anim.SetBool("Ss", true);
        respawning = false;
    }
Ejemplo n.º 3
0
 void Awake()
 {
     feeding       = false;
     foodSource    = GameObject.FindWithTag("Foodsource");
     _testMovement = gameObject.GetComponent <TestMovement>();
     //Increase the agent's hunger level every 5 seconds
 }
Ejemplo n.º 4
0
    // Alignment: Get the avereage velocity
    Vector2 computeAlignment(Transform myAgent)
    {
        Vector2 result         = Vector3.zero;
        int     neighbourCount = 0;

        foreach (Transform otherT in ListOfAgent)
        {
            if (otherT != myAgent)
            {
                if (Vector2.Distance(myAgent.position, otherT.position) < DETECT_RANGE)
                {
                    TestMovement enemy = otherT.GetComponent <TestMovement>();
                    result += enemy.velocity;
                    neighbourCount++;
                }
            }
        }

        if (neighbourCount == 0)
        {
            return(result);
        }

        result /= neighbourCount;
        result.Normalize();

        return(result);
    }
Ejemplo n.º 5
0
    private void Start()
    {
        _testMovement = GetComponent <TestMovement>();
        _movement     = _testMovement.MovementState;
        _conditions   = _testMovement.ConditionState;

        _movement.ChangeState(CharacterStates.MovementStates.Running);
    }
Ejemplo n.º 6
0
 private void Start()
 {
     tm        = TestMovement.instance;
     direction = Random.Range(-1, 1);
     if (direction == 0)
     {
         direction = -1;
     }
 }
Ejemplo n.º 7
0
 public void NewReference(Transform newTransfrom, TestMovement newTM, PlayerStats newPS, AnimatorController newAC, GameObject newlast, AudioSourceSetter newASS)
 {
     characterTransform = newTransfrom;
     TM      = newTM;
     PS      = newPS;
     AC      = newAC;
     gameObj = newlast;
     if (newASS != null)
     {
         ASS = newASS;
     }
 }
Ejemplo n.º 8
0
    void Awake()
    {
        startTime = Time.deltaTime;

        _testMovement = Agent.GetComponent<TestMovement>();

        state = State.Wander;
        //agentArr = new GameObject[spawnCounter];
        agentList = new List<GameObject>();

        hungerValList = new List<int>();

        //Uncomment to enable hunger actions
        //InvokeRepeating("AgentHunger", 1, 1);

        //StartCoroutine(FSM());
    }
Ejemplo n.º 9
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player" && isOpen == true)
     {
         collision.transform.position = new Vector2(findPosition.X, findPosition.Y);
         TestMovement t = collision.gameObject.GetComponent <TestMovement>();
         parent = exitPoint.transform.parent.gameObject;
         collision.transform.parent = parent.transform;
         parent.transform.TransformPoint(Vector3.zero);
         GameObject    middle = parent.transform.Find("Mid").gameObject;
         GameObject    camera = GameObject.Find("Main Camera");
         Camera_script s      = camera.GetComponent <Camera_script>();
         s.target = new Vector3(middle.transform.position.x, middle.transform.position.y, -10);
         StartCoroutine(camera.GetComponent <Camera_script>().Transition());
         t.passing();
     }
 }
Ejemplo n.º 10
0
 void FixedUpdate()
 {
     if (Input.GetKeyDown(KeyCode.E) && active && player.transform.parent.name == roomName && E.activeSelf && timer < 0)
     {
         TestMovement t = player.gameObject.GetComponent <TestMovement>();
         player.transform.position = new Vector2(findPosition.X, findPosition.Y);
         parent = exitPoint.transform.parent.gameObject;
         player.transform.parent = parent.transform;
         parent.transform.TransformPoint(Vector3.zero);
         GameObject    middle = parent.transform.Find("Mid").gameObject;
         GameObject    camera = GameObject.Find("Main Camera");
         Camera_script s      = camera.GetComponent <Camera_script>();
         //s.target = parent.transform;
         s.target = new Vector3(middle.transform.position.x, middle.transform.position.y, -10);
         //camera.target = parent;
         StartCoroutine(camera.GetComponent <Camera_script>().Transition());
         t.passing();
     }
 }
    //public VisualEffect explosion;

    private void Awake()
    {
        player      = GameObject.FindGameObjectWithTag("Player").GetComponent <TestMovement>();
        audioSource = GameObject.FindGameObjectWithTag("Music").GetComponent <AudioManager>();
    }
Ejemplo n.º 12
0
 void Start()
 {
     player   = GameObject.FindGameObjectWithTag("Player");
     movement = GameObject.FindGameObjectWithTag("Feet").GetComponent <TestMovement>();
 }
Ejemplo n.º 13
0
 void Start()
 {
     _testMovement = GetComponent<TestMovement>();
 }
Ejemplo n.º 14
0
 private void Awake()
 {
     instance = this;
 }
Ejemplo n.º 15
0
 void Start()
 {
     anim           = GetComponent <Animator>();
     playerMovement = GetComponent <TestMovement>();
     rb2d           = GetComponent <Rigidbody2D>();
 }
Ejemplo n.º 16
0
 // Use this for initialization
 void Start()
 {
     gravityGun = GameObject.FindGameObjectWithTag("Player").GetComponent <GravityGun>();
     movement   = GameObject.FindGameObjectWithTag("Feet").GetComponent <TestMovement>();
     rotateGun  = GameObject.FindGameObjectWithTag("Gun").GetComponent <RotateGun>();
 }