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


C++ object::GetController方法代码示例

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


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

示例1: NOFF_QueryCatchBlow

global func NOFF_QueryCatchBlow(object projectile, ...)
{
	// 100% shield if allied
	var w_controller = projectile->GetController();
	var t_controller = GetController();
	if (w_controller >= 0) // NO_OWNER is probably lost controller management (e.g. chain reactions). Always hit.
		if ((t_controller == ENEMY) == (w_controller == ENEMY)) // ENEMY can't hit ENEMY and others can't hit others.
			return true; // reject
	if (this.NOFF_backup_qcb) return this->NOFF_backup_qcb(projectile, ...);
	return false;
}
开发者ID:TheBlackJokerDevil,项目名称:openclonk,代码行数:11,代码来源:NoFriendlyFire_Clonk.c

示例2: FxHitCheckDoCheck

global func FxHitCheckDoCheck(object target, proplist effect)
{
    var obj;
    // rather search in front of the projectile, since a hit might delete the effect,
    // and clonks can effectively hide in front of walls.
    var oldx = target->GetX();
    var oldy = target->GetY();
    var newx = target->GetX() + target->GetXDir() / 10;
    var newy = target->GetY() + target->GetYDir() / 10;
    var dist = Distance(oldx, oldy, newx, newy);
    var is_human = GetPlayerType(target->GetController()) == C4PT_User;

    var shooter = effect.shooter;
    var live = effect.live;

    if (live)
        shooter = target;

    if (dist <= Max(1, Max(Abs(target->GetXDir()), Abs(target->GetYDir()))) * 2)
    {
        // We search for objects along the line on which we moved since the last check
        // and sort by distance (closer first).
        for (obj in FindObjects(Find_OnLine(oldx, oldy, newx, newy),
                                Find_NoContainer(),
                                Find_Layer(target->GetObjectLayer()),
                                Find_PathFree(target),
                                Sort_Distance(oldx, oldy)))
        {
            // Excludes
            if (!obj) continue; // hit callback of one object might have removed other objects
            if(obj == target) continue;
            if(obj == shooter) continue;
            if (is_human) {
                if (obj == g_windgen1) continue;
                if (obj == g_windgen2) continue;
                if (obj == g_windgen3) continue;
                if (obj == g_windmill) continue;
            }

            // Unlike in hazard, there is no NOFF rule (yet)
            // CheckEnemy
            //if(!CheckEnemy(obj,target)) continue;

            // IsProjectileTarget or Alive will be hit
            if (obj->~IsProjectileTarget(target, shooter) || obj->GetOCF() & OCF_Alive)
            {
                target->~HitObject(obj);
                if (!target)
                    return;
            }
        }
    }
    return;
}
开发者ID:pkern,项目名称:openclonk,代码行数:54,代码来源:HitCheck.c

示例3: HitObject

public func HitObject(object target, ...)
{
	// Go by controller
	var w_controller = GetController();
	var t_controller = target->GetController();
	if (w_controller >= 0) // NO_OWNER is probably lost controller management (e.g. chain reactions). Always hit.
		if ((t_controller == ENEMY) == (w_controller == ENEMY)) // ENEMY can't hit ENEMY and others can't hit others.
			return false;
	// OK, hit it
	return inherited(target, ...);
}
开发者ID:TheBlackJokerDevil,项目名称:openclonk,代码行数:11,代码来源:NoFriendlyFire_Ranged.c


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