상속: MonoBehaviour
예제 #1
0
 void Awake()
 {
     base.Awake();
     shockwavePrefab     = Resources.Load <GameObject>("Prefabs/Shockwave");
     sineShotPrefab      = Resources.Load <SineShot>("Prefabs/SineShot");
     spreadShotPrefab    = Resources.Load <SpreadShot>("Prefabs/SpreadShot");
     explodeAttackPrefab = Resources.Load <ExplodeAttack>("Prefabs/ExplodeAttack");
 }
예제 #2
0
파일: Player.cs 프로젝트: richao03/alpha
    // Start is called before the first frame update
    // void Awake()
    // {
    //   SetUpSingleTon();
    // }

    // private void SetUpSingleTon()
    // {
    //   if (FindObjectsOfType(GetType()).Length > 1)
    //   {
    //     Destroy(gameObject);
    //   }
    //   else
    //   {
    //     DontDestroyOnLoad(gameObject);
    //   }
    // }


    void Start()
    {
        weapon      = GetComponent <Weapon>() as Weapon;
        spreadShot  = GetComponent <SpreadShot>() as SpreadShot;
        spreadShot1 = GetComponent <SpreadShot1>() as SpreadShot1;
        impale      = GetComponent <Impale>() as Impale;

        gameStatus = FindObjectOfType <GameStatus>();
        SetUpMoveBoundary();
    }
예제 #3
0
    // Start is called before the first frame update
    public override void Updgrade(GameObject player)
    {
        Destroy(player.GetComponent <BaseWeapon>());
        Destroy(player.GetComponent <LaserShot>());
        Destroy(player.GetComponent <TripleShot>());
        SpreadShot spread = player.AddComponent <SpreadShot>();

        spread.firepoint    = player.GetComponent <PlayerController>().firePoint.transform;
        spread.bulletPrefab = player.GetComponent <PlayerController>().bulletPrefab;
        player.GetComponent <PlayerController>().attack = spread;
    }
예제 #4
0
 public Shotgun(
     float fireRate  = 2f,
     float damage    = 15,
     float nextFire  = 0.0f,
     float speed     = 75,
     int clipSize    = 1,
     int ammo        = 1,
     int spreadCount = 5) :
     base(fireRate, damage, nextFire, speed, clipSize, ammo, spreadCount)
 {
     ShootingType = new SpreadShot(this);
 }
예제 #5
0
    //Action 2.2 - Retaliate after pushback (using a spreadshot)
    public IEnumerator SpreadShot()
    {
        yield return(Retaliate());

        animator.SetTrigger(BossAnimation.AttackStandard);
        yield return(new WaitForSeconds(1));

        audioManager.Play("Crash");
        animator.SetTrigger(BossAnimation.Fire);
        spreadShot.transform.position = new Vector3(0, -1, 0);
        currentSpreadShot             = Instantiate(spreadShot, transform);

        yield return(new WaitForSeconds(1));

        animator.SetTrigger(BossAnimation.Idle);
        yield return(new WaitForSeconds(1));

        DefaultState();
    }
예제 #6
0
    public override void Detonate(AttackButtons attackToPerform)
    {
        switch (attackToPerform)
        {
        //Sine shot
        case AttackButtons.A:
            SineShot newShot = Instantiate(sineShotPrefab, transform.position, new Quaternion()) as SineShot;
            newShot.owningPlayer = owningPlayer;
            if (GameManager.S.inGame)
            {
                newShot.masochistPlayer = GameManager.S.players[(int)owningPlayer].character as M*******t;
            }
            else
            {
                newShot.target     = thisPlayer.otherPlayer.character.transform;
                newShot.thisPlayer = thisPlayer;
            }
            newShot.FireBurst();
            break;

        //Spread shot
        case AttackButtons.B:
            SpreadShot spreadShot = Instantiate(spreadShotPrefab, transform.position, new Quaternion()) as SpreadShot;
            spreadShot.owningPlayer = owningPlayer;
            if (GameManager.S.inGame)
            {
                spreadShot.masochistPlayer = GameManager.S.players[(int)owningPlayer].character as M*******t;
            }
            else
            {
                spreadShot.thisPlayer = thisPlayer;
            }
            spreadShot.FireBurst();
            break;

        //Explode attack
        case AttackButtons.X:
            ExplodeAttack explodeAttack = Instantiate(explodeAttackPrefab, transform.position, new Quaternion()) as ExplodeAttack;
            explodeAttack.owningPlayer = owningPlayer;
            explodeAttack.FireBurst();
            break;

        //Shield
        case AttackButtons.Y:
            return;

        default:
            Debug.LogError("Attack button " + attackToPerform.ToString() + " not handled in Bomb.Detonate()");
            break;
        }

        //Stop moving the bomb
        physics.velocity = Vector3.zero;

        if (GameManager.S.inGame)
        {
            SoundManager.instance.Play("BombExplode");
        }
        GameObject shockwave = Instantiate(shockwavePrefab, transform.position, new Quaternion()) as GameObject;

        Destroy(shockwave, 5f);
        Destroy(gameObject);
    }