void Start()
    {
        Invoke("StartTimer", 60);
        _player = GameObject.Find("Player").GetComponent <PlayerBehaviourScript>();

        timmer = Time.time;
    }
    public float[] Extract(PlayerBehaviourScript player)
    {
        float[] data = new float[4];

        data[0] = player.transform.position.x;
        data[1] = player.transform.position.y;

        foreach (var p in game.Players)
        {
            if (p != player)
            {
                data[2] = p.transform.position.x - player.transform.position.x;
                data[3] = p.transform.position.y - player.transform.position.y;
            }
        }

        if (player.Team == Team.Away)
        {
            for (int i = 0; i < data.Length; i++)
            {
                data[i] *= -1;
            }
        }

        return(data);
    }
    public float[] Extract(PlayerBehaviourScript player)
    {
        float[] data = new float[10];

        data[0] = player.transform.position.x;
        data[1] = player.transform.position.y;

        foreach (var p in game.Teams[player.Team])
        {
            if (p != player)
            {
                data[2] = p.transform.position.x - player.transform.position.x;
                data[3] = p.transform.position.y - player.transform.position.y;
            }
        }

        var sortedByDistanceOpponents = DistanceSorter.CloneAndSortByDistance(game.Teams[player.OpponentTeam], player.PivotPoint);

        for (int i = 4; i < 8; i += 2)
        {
            data[i]     = sortedByDistanceOpponents[i - 8].transform.position.x - player.transform.position.x;
            data[i + 1] = sortedByDistanceOpponents[i - 8].transform.position.y - player.transform.position.y;
        }

        if (player.Team == Team.Away)
        {
            for (int i = 0; i < data.Length; i++)
            {
                data[i] *= -1;
            }
        }

        return(data);
    }
示例#4
0
 void Start()
 {
     player        = GetComponent <PlayerBehaviourScript>();
     isFacingRight = true;
     anim          = GetComponent <Animator>();
     attack        = false;
     timecounter   = Time.deltaTime;
 }
示例#5
0
    void Start()
    {
        player_camera = GameObject.Find(player_camera_name);

        GameObject player = GameObject.Find(player_object_name);

        player_script = player.GetComponent <PlayerBehaviourScript>();
    }
    public void ToStartingPosition()
    {
        transform.parent      = null;
        controllingPlayer     = null;
        lastControllingPlayer = null;

        movement = new Vector3(0, 0, 0);

        transform.position = new Vector3(0, 0);
    }
    public void MoveTo(float x, float y)
    {
        transform.parent      = null;
        controllingPlayer     = null;
        lastControllingPlayer = null;

        movement = new Vector3(0, 0, 0);

        transform.position = new Vector3(x, y);
    }
示例#8
0
    void Start()
    {
        last_timestamp = System.DateTime.Now;

        GameObject player = GameObject.Find(player_object_name);

        player_script = player.GetComponent <PlayerBehaviourScript>();

        Screen.showCursor = false;
    }
示例#9
0
    //public AudioSource deadSound;



    void Start()
    {
        //targetTransform = GameObject.Find("Player").transform;
        targetTransform = GameObject.FindGameObjectWithTag("Player").transform;
        player          = GetComponent <PlayerBehaviourScript>();
        isFacingRight   = true;
        anim            = GetComponent <Animator>();
        attack          = false;
        timecounter     = Time.deltaTime;
        SetIdle();
    }
示例#10
0
 public void OnTriggerEnter(Collider other)
 {
     if (curPosingTime >= posingTimeOut &&  other.CompareTag("Player"))
     {
         isPosing = true;
         curPosingTime = 0;
         player = other.GetComponent<PlayerBehaviourScript>();
         player.StartPosing();
         ownAnimator.SetBool("IsTakingFoto", true);
     }
 }
    public void HitByPlayer(CollisionParams collisionParams)
    {
        controllingPlayer     = collisionParams.Player;
        lastControllingPlayer = collisionParams.Player;

        if (Args.GameMode != GameMode.Play)
        {
            game.Optimization.BallHitByPlayer();
        }

        transform.position = collisionParams.Position + new Vector3(-Mathf.Sin(collisionParams.Rotation) * DISTANCE_FROM_CONTROLLNG_PLAYER, Mathf.Cos(collisionParams.Rotation) * DISTANCE_FROM_CONTROLLNG_PLAYER);
        movement           = new Vector3(0, 0, 0);
        transform.parent   = collisionParams.Transform;
    }
示例#12
0
    void Start()
    {
        if (score == null)
        {
            Debug.LogError(this.name + "Coin is null in ->>" + name);
        }

        player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerBehaviourScript>();

        if (player == null)
        {
            Debug.LogError(this.name + " Player is null in ->> " + name);
        }
    }
示例#13
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag("Player"))
        {
            PlayerBehaviourScript _player = collision.gameObject.GetComponent <PlayerBehaviourScript>();
            _player.TakePickUp(this.gameObject);

            Destroy(this.gameObject);
        }

        if (collision.gameObject.CompareTag("Enemy Limiter"))
        {
            Destroy(this.gameObject);
        }
    }
    public void Kicked(PlayerBehaviourScript player, Vector3 targetPosition)
    {
        if (controllingPlayer != player)
        {
            return;
        }

        controllingPlayer = null;

        transform.parent = null;
        movement         = new Vector3(
            (targetPosition.x - transform.position.x) * BALL_KICK_SPEED_MULTIPLIER,
            (targetPosition.y - transform.position.y) * BALL_KICK_SPEED_MULTIPLIER,
            0);

        if (movement.magnitude > MAX_BALL_KICK_SPEED)
        {
            movement.Normalize();
            movement *= MAX_BALL_KICK_SPEED;
        }
    }
示例#15
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerBehaviourScript>();
 }
示例#16
0
 public abstract void InteracaoObjeto(PlayerBehaviourScript player);
示例#17
0
    // Use this for initialization
    void Start () {
        playerScript = player.gameObject.GetComponent<PlayerBehaviourScript>();

    }
示例#18
0
	// Use this for initialization
	void Start () {
        playerScript = player.gameObject.GetComponent<PlayerBehaviourScript>();
        InvokeRepeating("Spawn", spawnTime, spawnTime);
	}
    public void UpdateInGameUI()
    {
        foreach (Transform t in InGameUI.transform)
        {
            if (GameControllerScript.instance.PlayerInstance != null)
            {
                PlayerBehaviourScript pbs = GameControllerScript.instance.PlayerInstance.GetComponent <PlayerBehaviourScript>();

                if (t.CompareTag("Health Bar UI"))
                {
                    t.GetComponent <Slider>().maxValue = pbs.MaxHealth;
                    t.GetComponent <Slider>().value    = pbs.ChangeHealthBy(0);
                }
                if (t.name == "Cooldown Bar 1")
                {
                    t.gameObject.GetComponent <Slider>().value = pbs.GetPercentUnitlCooldown1();
                }
                if (t.name == "Cooldown Bar 2")
                {
                    t.gameObject.GetComponent <Slider>().value = pbs.GetPercentUnitlCooldown2();
                }

                if (t.gameObject.name == "First Weapon Text")
                {
                    t.gameObject.GetComponent <Text>().text = "First Weapon:" + System.Environment.NewLine + GameControllerScript.PlayerFirstWeapon.GetComponent <WeaponBehaviourScript>().weaponName;
                }
                if (t.gameObject.name == "Second Weapon Text")
                {
                    t.gameObject.GetComponent <Text>().text = "Second Weapon:" + System.Environment.NewLine + GameControllerScript.PlayerSecondWeapon.GetComponent <WeaponBehaviourScript>().weaponName;
                }
            }
            if (t.gameObject.name == "Currend Credits Text")
            {
                t.gameObject.GetComponent <Text>().text = "Credits:" + System.Environment.NewLine + GameControllerScript.currendCredits.ToString();
            }
            if (t.gameObject.name == "Currend Score Text")
            {
                t.gameObject.GetComponent <Text>().text = "Score: " + System.Environment.NewLine + GameControllerScript.currendScore.ToString();
            }
        }

        if (InGameExitMenu.activeSelf == true)
        {
            foreach (Transform tr in InGameExitMenu.transform)
            {
                if (tr.gameObject.name == "MusicImage")
                {
                    tr.gameObject.SetActive(!GameControllerScript.MusicIsMuted);
                }
                if (tr.gameObject.name == "NoMusicImage")
                {
                    tr.gameObject.SetActive(GameControllerScript.MusicIsMuted);
                }
                if (tr.gameObject.name == "SoundImage")
                {
                    tr.gameObject.SetActive(!GameControllerScript.SoundIsMuted);
                }
                if (tr.gameObject.name == "NoSoundImage")
                {
                    tr.gameObject.SetActive(GameControllerScript.SoundIsMuted);
                }
            }
        }
    }