当前位置: 首页>>代码示例>>C#>>正文


C# Fighter.GetComponent方法代码示例

本文整理汇总了C#中Fighter.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# Fighter.GetComponent方法的具体用法?C# Fighter.GetComponent怎么用?C# Fighter.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fighter的用法示例。


在下文中一共展示了Fighter.GetComponent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

    public override void Execute(Fighter fighterRef, PlayerCombatScript combatScript)
    {
        _fighterRef = fighterRef;
        fighterRef.GetComponent<Animator>().SetTrigger(_dashHash);
        PlayerControllerScript playerController = fighterRef.GetComponent<PlayerControllerScript>();

        playerController.CurrentXSpeed = ((playerController.MaxSpeed + 3) * playerController.getXDirection);

        if (playerController.CurrentXSpeed > 0)
            _fighterRef.FacingRight = true;
        else if (playerController.CurrentXSpeed < 0)
            _fighterRef.FacingRight = false;

        StartCoroutine(EndDash());
    }
开发者ID:chozoace,项目名称:ProjectAnubis,代码行数:15,代码来源:PlayerDash.cs

示例2: Execute

 public override void Execute(Fighter fighterRef, PlayerCombatScript combatScript)
 {
     fighterRef.GetComponent<Animator>().SetTrigger(_jumpHash);
        Vector2 v = gameObject.GetComponent<Rigidbody2D>().velocity;
        v.y = _jumpSpeed;
        fighterRef.gameObject.GetComponent<Rigidbody2D>().velocity = v;
 }
开发者ID:chozoace,项目名称:ProjectAnubis,代码行数:7,代码来源:Jump.cs

示例3: OnGotHit

 void OnGotHit(Fighter attacker)
 {
     Alive attackersAlive = attacker.GetComponent<Alive>();
     if (!charController.CommandIssued && !attackersAlive.IsDead) {
         charController.Command_Attack( attackersAlive );
     }
 }
开发者ID:fanfreeman,项目名称:LinkBattle,代码行数:7,代码来源:Hero.cs

示例4: SpawnSquadronVehicle

    public void SpawnSquadronVehicle(Fighter member, UniversePosition position, Quaternion rotation)
    {
        member.SpawnVehicle(member.gameObject, member.VehiclePrefab, position, rotation);
        var memberTracker = member.VehicleInstance.GetComponent<VehicleTracker>();

        var profile = member.GetComponent<ShipProfile>();

        if (profile.PrimaryWeapon != null)
            member.VehicleInstance.SetPrimaryWeapon(profile.PrimaryWeapon.gameObject);
        if (profile.SecondaryWeapon != null)
            member.VehicleInstance.SetSecondaryWeapon(profile.SecondaryWeapon.gameObject);

        var squadronTracker = member.VehicleInstance.gameObject.AddComponent<SquadronTracker>();
        squadronTracker.ArrowSprite = memberTracker.ArrowSprite;
        //squadronTracker.TrackerSprite = memberTracker.TrackerSprite;
        //squadronTracker.FarTrackerSprite = memberTracker.FarTrackerSprite;
        //squadronTracker.VeryFarTrackerSprite = memberTracker.VeryFarTrackerSprite;
        squadronTracker.LockingSprite = memberTracker.LockingSprite;
        squadronTracker.LockedSprite = memberTracker.LockedSprite;
        squadronTracker.TrackerPlanePrefab = TrackerPlanePrefab;
        Destroy(memberTracker);
        squadronTracker.CallSign = profile.CallSign;
        squadronTracker.TrackerColor = TrackerColor;
        squadronTracker.LabelFont = SquadronTrackerFont;
        squadronTracker.IsDisabled = false;
        member.IsFollowIdleDestination = true;
        var mapPin = member.VehicleInstance.gameObject.AddComponent<MapPin>();
        mapPin.ActivePin = PlayerController.Current.PlayerPinPrefab;
        mapPin.InactivePin = SquadronPinPrefab;
        mapPin.SetPinState(MapPin.MapPinState.Inactive);

        // Apply power profile
        member.VehicleInstance.Killable.MaxShield = profile.GetShield();
        member.VehicleInstance.Killable.Shield = member.VehicleInstance.Killable.MaxShield;

        var squadronShieldRegenerator = member.VehicleInstance.gameObject.AddComponent<ShieldRegenerator>();
        squadronShieldRegenerator.RegenerationDelay = ShieldRegenerateDelay;
        squadronShieldRegenerator.RegenerationRate = ShieldRegenerateRate;

        BindMemberEvents(member);

        member.enabled = true;
    }
开发者ID:talford2,项目名称:SpaceX,代码行数:43,代码来源:PlayerSquadron.cs

示例5: Awake

    private void Awake()
    {
        _current = this;
        Cursor.visible = !HideMouse;
        if (HideMouse)
            Cursor.lockState = CursorLockMode.Locked;

        _profile = GetComponent<ShipProfile>();
        _inventory = new PlayerInventory(15);

        _screenAspect = (float)Screen.height / (float)Screen.width;

        _playerNpc = gameObject.AddComponent<Fighter>();
        _playerNpc.Team = Team;
        _playerNpc.IsSquadronMember = true;
        _playerNpc.GetComponent<ShipProfile>().CallSign = CallSign;
        _playerNpc.VehiclePrefab = VehiclePrefab;
        _playerNpc.enabled = false;
        SpawnVehicle(VehiclePrefab, Universe.Current.PlayerSpawnPosition);
        _playerNpc.SetVehicleInstance(_playVehicleInstance);
        _playerNpc.IsFollowIdleDestination = true;

        SetControlEnabled(true);

        _aimMask = ~LayerMask.GetMask("Player", "Detectable", "Distant");
        _detectableMask = LayerMask.GetMask("Detectable");
        _collectableMask = LayerMask.GetMask("Collectible");
    }
开发者ID:talford2,项目名称:SpaceX,代码行数:28,代码来源:PlayerController.cs

示例6: Execute

    public override void Execute(Fighter fighterRef, PlayerCombatScript combatScript)
    {
        this.gameObject.SetActive(true);
        this.gameObject.GetComponent<SpriteRenderer>().enabled = true;
        _fighterRef = fighterRef;
        _combatScript = combatScript;
        _fighterRef.disableAnimator();
        //turn off collisions for fighter ref

        Rigidbody2D body = this.gameObject.GetComponent<Rigidbody2D>();

        if (_airAttack)
        {
            //If air attack, dont stop momentum, but pause it on hit.
            //Create on hit function
            body.gravityScale = _fighterRef.GetComponent<Rigidbody2D>().gravityScale;
            Vector2 v = _fighterRef.GetComponent<Rigidbody2D>().velocity;
            body.velocity = v;
            if(_isDiveKick)
            {
                Vector2 diveSpeed = new Vector2(4, -3);
                body.velocity = diveSpeed;
                fighterRef.GetComponent<Rigidbody2D>().velocity = diveSpeed;
            }
        }
        else if(_translate && fighterRef.GetComponent<PlayerControllerScript>())
        {
            Debug.Log("Translate");
            fighterRef.GetComponent<PlayerDash>().ForceEndDash();
        }
        else if (_fighterRef.tag == "Player")
            _fighterRef.GetComponent<PlayerControllerScript>().StopMovement();

        if (!_fighterRef.FacingRight)
            transform.localScale = new Vector3(1, transform.localScale.y, transform.localScale.z);
        else
            transform.localScale = new Vector3(-1, transform.localScale.y, transform.localScale.z);
    }
开发者ID:chozoace,项目名称:ProjectAnubis,代码行数:38,代码来源:Attack.cs

示例7: AttackFreeze

    //Currently only does air attack freeze ADD ONE FOR GROUND
    IEnumerator AttackFreeze(Fighter enemyRef)
    {
        _fighterRef.InHitstunFreeze = true;
        enemyRef.InHitstunFreeze = true;
        //
        enemyRef.EnterHitstun();
        //Freeze both player and target for x time
        Vector2 thisVelocity = _fighterRef.GetComponent<Rigidbody2D>().velocity;
        Vector2 otherVelocity = enemyRef.GetComponent<Rigidbody2D>().velocity;
        thisVelocity.y += 3;
        if (_slamSpeed != 0)
        {
            otherVelocity.y = _slamSpeed;
            thisVelocity.y = 4;
            if (otherVelocity.x > 0)
                otherVelocity.x += 4;
            else
                otherVelocity.x -= 4;
        }
        else
        {
            otherVelocity.y += 4f;
        }
        float thisGravity = _fighterRef.GetComponent<Rigidbody2D>().gravityScale;
        float otherGravity = enemyRef.GetComponent<Rigidbody2D>().gravityScale;
        _anim.speed = 0;
        _fighterRef.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
        _fighterRef.GetComponent<Rigidbody2D>().gravityScale = 0;
        enemyRef.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
        enemyRef.GetComponent<Rigidbody2D>().gravityScale = 0;

        yield return new WaitForSeconds(_hitstunFreezeTime);

        _anim.speed = 1;
        _fighterRef.GetComponent<Rigidbody2D>().velocity = thisVelocity;
        enemyRef.GetComponent<Rigidbody2D>().velocity = otherVelocity;
        _fighterRef.GetComponent<Rigidbody2D>().gravityScale = thisGravity;
        enemyRef.GetComponent<Rigidbody2D>().gravityScale = otherGravity;
        enemyRef.StartHitstunTimer(_hitstunTime);
        _fighterRef.InHitstunFreeze = false;
        enemyRef.InHitstunFreeze = false;
    }
开发者ID:chozoace,项目名称:ProjectAnubis,代码行数:43,代码来源:Attack.cs


注:本文中的Fighter.GetComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。