示例#1
0
        public AmbxAddon()
        {
            NotifyIcon notifyIcon = new NotifyIcon();

            notifyIcon.CreateNotifyicon("amBX Addon", "gun3.ico", "E&xit");
            var movingBehaviour   = new MovingBehaviour();
            var shootingBehaviour = new ShootingBehaviour();
        }
示例#2
0
 // Use this for initialization
 void Start()
 {
     Speed                  *= 100;
     CurrentPosition         = transform.position;
     CurrentWeapon           = GetComponent <ShootingBehaviour>();
     rb2d                    = GetComponent <Rigidbody2D>();
     Input.multiTouchEnabled = true;
 }
示例#3
0
 // Start is called before the first frame update
 void Start()
 {
     //find objects we need
     m_PlayerShootingBehaviour = FindObjectOfType <ShootingBehaviour>();
     m_PlayerMovementBehaviour = FindObjectOfType <MovementBehaviour>();
     m_PlayerBehaviour         = FindObjectOfType <PlayerCharacter>();
     //set time to 1 when the game starts
     Time.timeScale = 1;
 }
示例#4
0
 private void Awake()
 {
     _playerScript            = GetComponent <Player>();
     _playerRigidbody         = _playerScript.GetComponent <Rigidbody>();
     _playerShootingBehaviour = _playerScript.GetComponent <ShootingBehaviour>();
     _playerStealthBehaviour  = _playerScript.GetComponent <StealthBehaviour>();
     _playerCollider          = _playerScript.GetComponent <Collider>();
     _healthBehaviour         = _playerScript.GetComponent <HealthBehaviour>();
 }
示例#5
0
 private void Awake()
 {
     MovementBehaviour        = GetComponent <MovementBehaviour>();
     ShootingBehaviour        = GetComponent <ShootingBehaviour>();
     _stealthBehaviour        = GetComponent <StealthBehaviour>();
     _takeOverBehaviour       = GetComponent <TakeOverBehaviour>();
     _interActionBehaviour    = GetComponent <InterActionBehavior>();
     HealthBehaviour          = GetComponent <HealthBehaviour>();
     _defendingBehaviour      = GetComponent <DefendingBehaviour>();
     _swithcTakeOverBehaviour = GetComponent <SwitchTakeOverBehaviour>();;
 }
示例#6
0
    protected void Awake()
    {
        _movementBehaviour = GetComponent <MovementBehaviour>();
        _shootingBehaviour = GetComponent <ShootingBehaviour>();
        _healthBehaviour   = GetComponent <HealthBehaviour>();
        _lootDropBehaviour = GetComponent <LootDropBehaviour>();

        State = EnemyState.passive;

        _player = FindObjectOfType <Player>().transform;
        _playerStealthBehaviour  = _player.GetComponent <StealthBehaviour>();
        _attentionAngleInRadians = (_attentionAngleInDegrees * Mathf.PI) / 180.0f;
    }
示例#7
0
 void Update()
 {
     if (GameManager.GetStage() == GameManager.Stage.PlayerAim)
     {
         if (hasSnap)
         {
             Vector3 newMousePosition = Input.mousePosition;
             //Angulo é calculado pela diferença no eixo y e a força na diferença do eixo y
             float angle = (snapPosition.y - newMousePosition.y) / 200;
             if (angle > Mathf.PI)
             {
                 angle = Mathf.PI;
             }
             float shotPower = Mathf.Abs((snapPosition.x - newMousePosition.x) / 20);//diferença no eixo x é a força do tiro
             if (shotPower > 20)
             {
                 shotPower = 20;
             }
             Camera.main.orthographicSize = (shotPower / 8f) + 3; //Afasta a camera de acordo com a força do tiro
             GameManager.SetAngle(angle);
             GameManager.shotPower = shotPower;                   //Guarda a força do tiro no GameManager
             if (shotPower >= 2)
             {
                 hud.EnablePopUp();
                 hud.UpdatePopUp(angle, shotPower);
             }
             else
             {
                 hud.DisablePopUp();
             }
         }
         if (!hasSnap && CrossPlatformInputManager.GetButtonDown("Fire1")) //Começou a mirar
         {
             snapPosition = Input.mousePosition;                           //varia a força e angulo baseado em onde a pessoa clicou
             hasSnap      = true;                                          //Player está mirando
             hud.CreatePopUp(snapPosition);
         }
         if (CrossPlatformInputManager.GetButtonUp("Fire1"))//Player deixou de mirar
         {
             hasSnap = false;
             if (GameManager.shotPower >= 2)                         //Se o tiro for muito fraco a flecha não é disparada
             {
                 GameManager.SetStage(GameManager.Stage.playershot); // Passagem da rodada de jogador atirar para tiro do jogador
                 GameManager.cameraInPosition = false;
                 hud.DisablePopUp();
                 ShootingBehaviour.Shot(GameManager.shotPower, GameManager.angle, GameManager.arrow);
             }
         }
     }
 }
示例#8
0
    IEnumerator Aim(Vector3 playerPosition, float precison = 0.002f)
    {
        float distance           = Vector3.Distance(gameObject.transform.position, playerPosition);
        float angle              = 0;
        float time               = 0;
        float horizontalVelocity = 0;
        int   totalVelocity;
        float animationTimer = 0;

        for (totalVelocity = 4; totalVelocity <= 20; totalVelocity++)
        {
            angle = 0;
            for (angle = 0; angle < 1;)
            {
                angle += precison;
                horizontalVelocity = totalVelocity * Mathf.Cos(angle);
                float verticalVelocity = totalVelocity * Mathf.Sin(angle);
                time = -(verticalVelocity * 2 / Physics.gravity.y); //Gravidade no unity no eixo y = -9.8
                if (time > (distance / horizontalVelocity))
                {
                    break;
                }
            }
            bow.SetBowRotation(Mathf.PI - angle);
            if (time > (distance / horizontalVelocity))
            {
                break;
            }
        }
        //Quando a animação for executada a inteligencia artificial ja vai ter completado os calculos
        //Esta animação poderia ser feita pelo animator, mas como ja possuia um script que fazia a troca de sprites
        //(BowBehaviour), preferi aproveita-lo e fazer por código
        while (animationTimer < 1)
        {
            animationTimer += 0.03f;
            //Camera se afasta, da mesma forma de como quando o player atira, dando a impressão de que o inimigo esta aumentando a força
            Camera.main.orthographicSize = Mathf.Lerp(3, totalVelocity / 8f + 3, animationTimer);
            //Arco rotaciona, dando a impressão de que a ia esta mirando
            bow.SetBowRotation(Mathf.Lerp(Mathf.PI, Mathf.PI - (angle), animationTimer));
            //Muda o sprite do arco, incrementalmente na direção do sprite com a corda mais puxada
            bow.SetBowPosition(Mathf.FloorToInt(4 * animationTimer + 1));
            yield return(new WaitForSeconds(0.03f));
        }
        //Adiciona erro tanto na velocidade do tiro quando no angulo de disparo.
        ShootingBehaviour.Shot(totalVelocity + totalVelocity * Random.Range(-erro, erro), (Mathf.PI - angle) + (Mathf.PI - angle) * Random.Range(-erro, erro), GameManager.arrow);
        //Atira e muda o estágio do jogo para EnemyShot
        GameManager.cameraInPosition = false;
        GameManager.SetStage(GameManager.Stage.EnemyShot);
    }
示例#9
0
    private void Awake()
    {
        var towerProperty = gameObject.AddComponent <BasicTower>();

        currentLevel   = towerProperty.level;
        possibleLevels = Enum.GetValues(typeof(TowerProperty.Level)).Cast <TowerProperty.Level>().ToList();  //Liste der Level enums

        shootingBehaviour = GetComponent <ShootingBehaviour>();
        shootingBehaviour.SetTowerPropertyReference(towerProperty);
        shootingBehaviour.OnFire += Shoot;

        bullets = GetComponentInChildren <ParticleSystem>();

        tud = GameObject.FindObjectOfType <TowerUpgradeDowngrade>();
    }
示例#10
0
    void Start()
    {
        //find an object of type player
        PlayerCharacter player = FindObjectOfType <PlayerCharacter>();

        //find an object of type level
        m_LevelLogic = FindObjectOfType <LevelLogic>();
        //find the director
        m_Director = FindObjectOfType <Director>();
        //if player exist acces its health and shootingbehaviour script and store it
        if (player)
        {
            m_PlayerHealth            = player.GetComponent <Health>();
            m_StressLevel             = player.GetComponent <StressLevel>();
            m_PlayerShootingBehaviour = player.GetComponent <ShootingBehaviour>();
        }
    }
示例#11
0
 public override void Initialize()
 {
     ItemStats["Spreading"]    = new Stat(Settings.Spreading);
     ItemStats["ShotInterval"] = new Stat(Settings.ShotInterval);
     ItemStats["Weight"]       = new Stat(Settings.Weight);
     ItemStats["Price"]        = new Stat(Settings.Price);
     ItemStats["ClipSize"]     = new Stat(Settings.ClipSize);
     ItemStats["ReloadTime"]   = new Stat(Settings.ReloadTime);
     Name           = Settings.Name;
     shootingModule = gameObject.AddComponent <ShootingModule>();
     shootingModule.LoadedProjectile = Settings.Projectile;
     shootingModule.ProjectileSpawn  = ProjectilesSpawn;
     shootingModule.ShotEffect       = Settings.ShootEffect;
     shootingModule.AttachedEntity   = this;
     shootingModule.Initialize(Settings);
     if (customShootingBehaviour != null)
     {
         Behaviour = ScriptableObject.CreateInstance(customShootingBehaviour.GetClass()) as ShootingBehaviour;
         OnShoot   = delegate
         {
             Behaviour.OnShoot.Invoke(this);
         };
     }
 }
示例#12
0
 void Start()
 {
     Vehicle = gameObject.GetComponent<VehicleController>() as VehicleController;
     ShootingBehaviour = gameObject.GetComponentInChildren<ShootingBehaviour>() as ShootingBehaviour;
     TankTurret = gameObject.GetComponentInChildren<TankTurretBehaviour>() as TankTurretBehaviour;
     Manager = Object.FindObjectOfType(typeof(MatchManager)) as MatchManager;
 }
示例#13
0
 protected virtual void Awake()
 {
     m_ShootingBehaviour = GetComponent <ShootingBehaviour>();
     m_MovementBehaviour = GetComponent <MovementBehaviour>();
 }
示例#14
0
 void Start()
 {
     //finds the shootingbehaviour attached to the player
     m_Behaviour = FindObjectOfType <PlayerCharacter>().gameObject.GetComponent <ShootingBehaviour>();
 }
 void Start()
 {
     TurretShooting = GetComponent<ShootingBehaviour>();
 }